HPlogo MPE/iX Commands Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 6 Command Definitions P-R

PAUSE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The PAUSE command allows the current task to be suspended or "sleep" for a specifiec number of seconds.)

NOTE: This command follows the optional MPE/iX command line syntax. Refer to "Optional Format for MPE/iX Commands" at the beginning of this chapter.

Syntax

PAUSE [num_seconds]
[[ ;JOB= ]jobid]
[ [;INTERVAL=] interval_secs]
[ ;EXIST | WAIT | NOTEXIST]

Parameters

Collectively EXIST, WAIT and NOTEXIST are referred to as the "while_state", since PAUSE sleeps "while" the specified state is true.

num_seconds

If num_seconds is specified without jobid PAUSE sleeps for that many seconds, or until the process issuing the pause is interrupted by the break signal. If "jobid" is also supplied then "num_seconds" has a different meaning. In this case it indicates the maximum duration for the PAUSE command, such that PAUSE should continue while the selected jobs are in their "while_state" or when num_seconds has expired, whichever is shortest. Thus, num_seconds represents the maximum length of the pause. If PAUSE completes but one or more jobs are still in their "while state" a CIWARN is reported.

NOTE: to pause while a job is in its "while_state" or until num_seconds has expired, whichever is LONGEST, one can execute the following two commands:

PAUSE x PAUSE job=y ;z

If after X seconds job Y is still in state Z then the second PAUSE continues while state Z applies. On the other hand, if after X seconds job Y is not in state Z then the pause is complete. or equal to zero.

jobid

can be one of: [#]Jnnn, [#]Snnn, [ jobname,]user.acct, @, @J, @S. Note if jobname is included than the jobid must be quoted since the comma is a command token delimiter.

If the JOB= parameter is specified then PAUSE sleeps while jobid is in its "while_state". jobid can be an executing, waiting, scheduled job, or a session. jobid can also name many jobs or sessions. Wildcarding is supported, and a non-wildcarded [jname,]user.acct can match several jobs or sessions. The job name value can be " ," or " @," to match all jobs or sessions without a job name. When more than one job or session matches jobid PAUSE sleeps while all matching jobs are in their "while_state". If the job executing PAUSE matches jobid it will not be selected.

interval_secs

If interval_secs is specified PAUSE sleeps for this many seconds between attempts to see if jobid is still in its "while_state". Otherwise, PAUSE sleeps a variable amount of seconds depending on the job state and the number of previous times a particular job has been polled. This computed method favors executing jobs that terminate quickly.

EXIST

(default) means to pause while all jobs and sessions matching "jobid" exist. These jobs can be scheduled, waiting, executing, etc., but as long as the SHOWJOB command displays one or more of the jobs defined by "jobid", the pause continues

WAIT

means to pause while the selected job or jobs are waiting. As soon as all the matching jobs are no longer waiting (meaning all the job states are no longer "introduced", "waiting", or "scheduled") the pause ends. The life cycle of a job is typically: [sched or waiting->] intro-> initializing-> exec-> [susp-> exec->] terminate. Waiting jobs are considered all job states left of and excluding "initializing". Non-waiting jobs are all jobs right of and including "initializing"

NOTEXIST

means to pause while the matching job or jobs do not exist. As soon as any jobs matching "jobid" exist (in any state) the pause completes. PAUSE might miss finding jobs that log off quickly. This is particularly true for a match on a single job/session number. A more practical use might be: PAUSE job=@J;notexistwhich means to sleep while no jobs exist. As soon as the first job is streamed the above pause stops.

Operation Notes

The value of this command lies in providing a way to suspend one activity while another process waits for a specific condition to exist, for example, forcing a job to "idle" while waiting for the creation of a key file or the setting of a crucial flag. You may use several MPE/iX commands to query user or system variables, or the system itself, in order to verify the existence of the desired condition.

In its simpliest form, the PAUSE command sleeps for "num_seconds", or less if BREAK is pressed. In this simple case no "jobid" is specified and all other command arguments are ignored. If the "jobid" parameter is specified then "interval_secs" and the remaining command parameters are relevant. When "jobid" is supplied PAUSE typically sleeps until the jobs or sessions matching "jobid" have terminated.

Use

This command is available from a program or in BREAK. You can execute BREAK while PAUSE is active. BREAK terminates the 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 runningThe next example pauses while all jobs (by naming convention only) in the PROD account are running.

 :PAUSE job="J@,@.PROD"

# note the quotes are requiredThe next example sleeps while the backup job ("JBACKUP,OP.SYS") has not been streamed. PAUSE reports CIWARN 9032 if the job is not streamed within 30 minutes.

:PAUSE 1800, job="jbackup,op.sys"; notexist

The final example polls the system job table every 3 minutes looking for any job or session matching a user name that includes the letters "MGR", and waits for all such job/sessions to terminate before the pause ends.

:PAUSE , @mgr@.@ , 180

Related Information

Commands

WHILE, INPUT, SHOWJOB

Manuals

None

Feedback to webmaster