[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Foot-Warner? Monitoring Success or lack there of



Norman,

It is not possible to trap a user event (such as abort) from within SQR.
However it is possible to send a return status from the SQR to the
operating system to indicate success or not. At the beginning of your
SQR Program you can set the #return-status to a value indicating failure
(which for Windows is 1), then as one of the last commands that will be
executed set #return-status to success.  If the program aborts in the
middle of execution for any reason, including user intervention, the
return status passed to the operating system will be failure.

!
!Return Status
!
#ifdef VMS
#define GOOD-OS-STATUS 1
#define BAD-OS-STATUS  0        ! Added GMB 08/26/99
#else
#define GOOD-OS-STATUS 0
#define BAD-OS-STATUS  1        ! Added GMB 08/26/99
#endif

!----------------------------------------------------------------------
Begin-Report
!----------------------------------------------------------------------

  ! If the report errors out due to an execution error, you want to
  ! send a failure code to the operating system.
  move {BAD-OS-Status}  to #Return-Status

  do Init-Report
  do Process-Main
  do Reset                      ! RESET.SQC

  ! Program was successful; send a success code to the operating system
  ! and update the Process Run Status
  move {Good-OS-Status} to #Return-Status
  do Stdapi-Term                ! STDAPI.SQC

End-Report


Hope this helps!

Gina Bencke
Bencke Consulting Corporation
gina@bencke.com

-----Original Message-----
From: DaveL Smith [mailto:davesmit@US.IBM.COM]
Sent: Wednesday, October 06, 1999 7:21 AM
To: Multiple recipients of list SQR-USERS
Subject: Re: Foot-Warner?


Norman,

I have been less than impressed with SQR ability to monitor and recover
from
errors.   I don't know of any way that you can monitor a user
terminating SQR.
I have been having problems with ODBC connections failing during my
program, and
having to code and flag records accordingly so I can recover on the next
run,
its a real pain.

The only suggestion I would have here is to write an entry at the end of
your
file if it completes successfully, then check for that, assume the user
aborted
if the file does not contain the last line.  You could then inform the
user to
clean up their own mess, or offer to delete the offending fragments the
next
time the SQR was run.


David L. Smith
IBM Global Services




Norman Dolph <NEDOLPH@AOL.COM> on 10/06/99 07:45:22 AM

Please respond to SQR-USERS@list.iex.net

To:   Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
cc:
Subject:  Foot-Warner?




Warmest Thanks for previous help!   -  Here is the Problem...

The application is selecting and writing records into a flat ASCII file,
"c:\foobar.txt".  It could run a long time. (Platform is PeopleSoft
windows
NT)

The User is looking at the minimized SQRW button in the Tray. User gets
bored
and decides to bail out by right clicking this icon and selecting
"Close."

Thus the file on c:  is PARTIALLY written and sitting there.
------
The question: Can the user's electing to ABORT  fire an event WITHIN the
SQR
code to WRITE a footer message to this file before closing it?
Such as:
"WARNING!  This file was terminated by operator, and may be corrupt or
incomplete!"

Alternatively, is there a way - within the SQR code - to close and blow
away
the file fragment if the user bails out.  That way the user only gets
all or
none.

All best,

Norman Dolph