How to catch two messages at the same time?

Document ID : KB000091837
Last Modified Date : 17/04/2018
Show Technical Document Details
Introduction:
How to correlate the execution of one rule with the execution of another rule? 
For example, a product issues the following 2 messages:

PDT0185 ABEND=S0C1 MODULE=DT$DII OFFSET=00005E64 DB2=101 
PDT0102 DETECTOR TERM IN PROGRESS FOR DB2=DSNA USER=CONSOLE 

A restart of the service must be performed when the second message appears but only when first message has also appeared.
Instructions:
Address space related variables (GLVJOBID) can be used to save information from the first execution of the rule to be used at the second rule.
For example, the first message rule would be:
)MSG PDT0185
)PROC
GLVJOBID.ABEND = 'YES' 

At the other message rule:
)MSG PDT0102 
)PROC 
if OPSVALUE('GLVJOBID.ABEND','E') = 'N' then /* if the variable does not exist exit */
  return
/* Take actions here to restart the service */

/* then delete the variable to prepare to the next execution */
REM = OPSVALUE('GLVJOBID.ABEND','R')

 
Additional Information:
Reference to the usage of the GVLJOBID variable type can be found in the link below:

https://docops.ca.com/ca-opsmvs-13-0/en/using/using-automated-operations-facility-aof-rules/aof-rule-tools/aof-variables#AOFVariables-AddressSpace-relatedVariables

Reference to the OPSVALUE function:

https://docops.ca.com/ca-opsmvs-13-0/en/reference-information/command-and-function-reference/ops-rexx-built-in-functions/opsvalue-function