CA OPSMVS : How to include a Wait/Delay command in a MSG rule
search cancel

CA OPSMVS : How to include a Wait/Delay command in a MSG rule

book

Article ID: 101838

calendar_today

Updated On:

Products

OPS/MVS Event Management & Automation

Issue/Introduction

Sometimes it could be necessary to build for example a MSG rule that will wait a short duration of time prior to entering a specific command.

CA OPSMVS provides the OPSWAIT function that suspends processing of the program or rule for a specified period in an OPS/REXX program or REQ rule. It can be used in OPS/REXX, AOF rules, TSO/E REXX, or CLIST but it does not work outside a REQ rule.  It is documented in Command and Function Guide. 
One of the main restrictions it has is that it cannot be used in any type of rule other than an REQ rule. The use of OPSWAIT in a TOD rule delays the execution of other TOD rules. The specification of OPSWAIT in any other type of rule is ignored.
In addition it is not possible to include a WAIT in a rule as this would affect OPS execution and performance so this is ignored. 

How to build a  rule which will wait a short duration of time before executing a specific command, avoiding to cause a performance problem in product execution?

 

Environment

Z/OS - OPSMVS 

Resolution

A possible way to accomplish this is to create a new REXX program that can be call for example SLEEPSEC REXX and that will contain all the actions to be executed after the WAIT, that will be the first statement of the REXX. 
In this way the OPSMVS rule would only call the SLEEPSEC REXX and finish without any other actions. If it would be necessary to pass parameters to the REXX, this can be done in the OI statement in the following way: 

address OSF "OI PROGRAM(SLEEPSEC) ARG("MSG.JOBNAME" "MSG.TEXT")"

In the SLEEPSEC REXX program it will be necessary to receive the variables with an ARG statement:

ARG JOBNAME TEXT.

Another possibility could be to use a dynamic )TOD rule inside the main rule, looking like the following:

insecs = '10' /* total time in secs to wait */ 
queue ")TOD *+"insecs" secs" 
queue ")PROC" 
queue "address OPER" 
queue "'Command("cmd") Nooutput'" 
address AOF 
"Enable *Dynamic."rulename 

For example : 
...
if (WORD(MSG.TEXT.4,3) = "SOFT23AB*E*"), 
&(WORD(MSG.TEXT.4,6) = "SOFT23.TEST.LIB"), 
&(WORD(MSG.TEXT.5,1) = "BLOCKER"), 
then do 
QUEUE ")TOD *+10 SECS" 
QUEUE ")PROC" 
QUEUE "ADDRESS TSO" 
QUEUE "'OPSCMD COMMAND(RO "SYSV1",C U="USERV1") NOO'" 
ADDRESS AOF 
"ENABLE *DYNAMIC.CMDDELAY" 
end 

The above rule will dynamically enable a TOD rule to delay the execution of the command by 10 seconds.

Additional details can be found in CA OPSMVS Using AOF Rules Guide.