Have you ever tried to keep a job or certain steps in a job to wait for sometime and then execute without using any scheduler ?
When would it be useful to ask mainframes to sleep like this?
Few days back ,came across a specific scenario when it was needed to put a job step on hold for sometime and then execute it.
Say for unit testing you want to execute two jobs in certain instance to check dataset conflict or table conflict.
Suppose we have a job with 3 steps. We want to execute step1 an then wait for sometime, say 1 minute, and then execute the remaining 2 steps. How do we do it ?
OPSWAIT is the option which can help us in this scenario. (We need CA tool to be installed in our environment).
The OPSWAIT function suspends processing of the program or rule for a specified period in an OPS/REXX program or REQ rule.This function can be used in OPS/REXX, AOF rules, TSO/E REXX, or CLIST.
//PSTEP01 EXEC PGM=TSTPGM
//PSTEP02 EXEC PGM=OPSWAIT,PARM='FOR(01:00)'
//PSTEP03 EXEC PGM=TSTPGM2
Once you submit this JCL, it till execute the step PSTEP01,then it will cause the mainframe to sleep for 1 min and then execute step 2.
We can try this command going into TSO command (option 6) and typing OPSWAIT 01:00.(01=mins,00=seconds)
We can also use this JCL to put the program on hold.
//SLEEP EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *