Tuesday, August 4, 2015

Can we delay the execution of a mainframe job?OPSWAIT is an option

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.

//Jobcard..
//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 * 
OPSWAIT FOR(01:10) 
//* 

4 comments:

  1. Rik,

    The OPSWAIT option will work irrespective of third party products...? I think this is an option which will come with CA Tool OPS/MVS® Event Management and Automation - 12.2, If we don't have this product in our environment I don't think so OPSWAIT will be usefull

    ReplyDelete
    Replies
    1. Hi BoB.. You are correct. This option comes with CA installation. I will find out the other ways if exists, which can be used in z/os without CA being installed in our environment. Thanks again for your feedback!

      Delete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in TECHNOLOGY , kindly Contact MaxMunus
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 1,00,000 + trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Saurabh srivastava
    MaxMunus
    E-mail: saurabh@maxmunus.com
    Skype id: saurabhmaxmunus
    Ph:+918553576305
    www.MaxMunus.com


    ReplyDelete
  3. Will this sleep command keep on utilizing the CPU? If so it will increase the running cost.

    ReplyDelete