A SERVICE OF

logo

430 Chapter 6
Command Definitions P-R
PAUSE
Examples
If a job must read data from a file called LOGDAT.GXK.PROCCTRL, which is to be created by
a session, then the job may suspend activity pending a test for the existence of the vital
file.
The example below shows how the PAUSE command can be used to synchronize a session to
some job activity via the existence of a known file:
STREAM JLOGEND
#J123
...
...
SETVAR START_CPU HPCPUSECS
WHILE NOT FINFO("LOGDAT.GXK.PROCCTRL","EXISTS") AND &
HPCPUSECS-START_CPU <5 DO
PAUSE 2
ENDWHILE
DELETEVAR START_CPU
NOTE The CPU seconds used by the WHILE loop is not allowed to exceed 5 seconds.
If the file does not exist and the WHILE loop has consumed less than five CPU seconds,
then the job pauses for two seconds. This pause does not use CPU-time. The CPU check is
included to prevent an infinite loop that may result if JLOGEND aborted unexpectedly and
thus did not get a chance to build the LOGDAT file.
The following example pauses while job #J24 exists in the system job table, (JMAT) i.e., it
is visible in SHOWJOB output.
:PAUSE job=#j24
The next example sleeps as long as MANGER.SYS has any jobs or sessions running or
waiting.
:PAUSE job=manager.sys; exists
The next example pauses until the job just streamed starts executing.
:STREAM myjob
:PAUSE job=!hplastjob; wait
Or, sleeps until the job you just streamed completes.
:PAUSE , !hplastjob
The following example sleeps until all jobs have logged off or 5 minutes, whichever occurs
first.
:PAUSE 300, @J
:IF hpcierr = -9032 then
# pause terminated but one or more jobs are still running
The next example pauses while all jobs (by naming convention only) in the PROD account
are running.
:PAUSE job="J@,@.PROD"
# note the quotes are required