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

Re: Pausing SQR



Hi Jason,

I had a similar problem last month using "Call System Using" to do a file
sort.  The next steps in the SQR would be executed before the sort was
completed.  With a spice of my own thinking and very generous proportions of
help here, I was able to fix.

A better solution to your problem, IMO, (and what I did) is confirm the
process is completed before preceding with the next step, the processing of
the SQR file.

Quick thought: how about an SQR that calls a batch job, your first SQR.  As
a last step in that batch file, have a rename or delete.  In the SQR after
the batch call check if that file exists using a while loop.  As long as the
file exists (or doesn't depending on your logic) SQR will loop.  It will not
continue to your next step, that is the call of the next SQR until your
first process is complete.  Here's a sample of my logic:

----------------
In the following code, I call a UNIX shell (batch) script that merges a file
(A) with another file (B).  It then (as last step) renames A file.  As long
as A file exists the shell has not completed.  My code after the "call
system using" command therefore checks for file A; as long as file A exists,
the system will keep checking for its existence. Once the file no longer
exists, that is an indicator that the shell script has completed.

LET $command_string = $unix_dir||'sat_merge.sh'
CALL SYSTEM USING $command_String #status
 If #status <> 0
   SHOW '******* PROCESS ABORTED *********** '
   SHOW 'ERROR during execution of SAT merge.  Status code is: '#Status EDIT
999
   SHOW {BLANK}
   DO Um-Sql-Error
   SHOW {BLANK}
  End-If

While 1
  let #exists = EXISTS($sat_input)

  !If the file exists the return status is 0
  If #exists <> 0
    break
  End-If

End-While


-------------------------
Hope that helps
Anne-Marie




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anne-Marie Matula
Student Information System Project
Office of Information Technologies
Whitmore Bldg, University of Massachusetts, Amherst
Phone:  413/577-0685
Fax:    413/545-2150

>
> Date:    Mon, 13 Mar 2000 16:02:04 -0500
> From:    Jason Maurer <JMaurer@WIREDEMPIRE.COM>
> Subject: Pausing SQR
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01BF8D2F.64FE51D2
> Content-Type: text/plain;
>         charset="iso-8859-1"
>
> I currently run a 2 step process that needs to change.  The first
> step sends
> a request to a listserv server and requests a data file (if applicable).
> The second step processes the data file.  Our current process calls a dos
> batch file via batch job server that executes the 2 sqr programs in order.
> The problem that we run into is that the requested data file arrives
> anywhere between 1 minute and 30 minutes.  So every time the 2nd program
> kicks off the data file isn't here yet and the file does not get
> processed.
> The data file does get processed, but 24 hours later.  We don't wan't to
> create 2 jobs 30 minutes apart because we don't always have a file to
> request and also because we need to streamline the processing and not wait
> the 30 minutes if we are not requesting a file.
>
> What I need to do is put in some sort of pause in the sqr program
> that only
> occurs if we have a file to request.  Also, I don't want to just put in a
> loop that will max out the cpu of the server.
>
> Does anyone know of a way to cause sqr to pause for a certain
> amount of time
> without taxing the cpu?
>
> Thanks in advance!!
>
> Jason