The following describes how to create message set OPAL code that can page on any event that will terminate based on another message being received.
For example, you might use this OPAL to page a responsible party if a power outage message (CPF1816) is received. If a power restore (CPF1817) message is received in the time it takes to page the party, the request to page is canceled and the message set jobs are ended.
Create a Data Area
The following data area will be used to hold the job information of the first Robot Console message set that will page.
Create a data area in a library to hold job information. This data area should be a *CHAR type and have a length of 27:

where:
Position |
Value |
1 – 10 |
Message Set Job Name |
11 – 20 |
Message Set Job User Name |
21 – 26 |
Message Set Job Number |
27 |
Message Set Job Active Flag |
If message CPF1817 is received and processed by Robot Console, the message set associated with it will read the contents of this data area, determine if the CPF1816 message set job is active and, if it is, end it using *IMMED. If the first message set job is not active, the second message set job will end gracefully.
Create a Message Set for CPF1816
When the message CPF1816, System utility power failed at &1. is received, the following message set OPAL will execute:

Note: There are no Logic Operands or Variables in this OPAL code.
The OPAL code does the following:
-
Sequence 10 retrieves the OPAL job’s attributes and places them into variables:

-
Sequence 20 changes the data area we created to write these values. It also includes the Message Set Job Active Flag entry '1' at the end to let any other message set OPAL code know this is active.

-
Sequence 30 delays the job by 2 minutes (120 seconds) to allow time for the power to be restored before the page is sent.
-
Sequence 40 performs the PAGE operation via Robot Alert using the Robot Console OPAL variable TEXT. This sends the entire first-level text of the CPF1816 message to the specified device.
-
Sequence 50 sets the Message Set Job Active Flag to 0 to let other potential OPAL jobs know that the page was executed and the message set job no longer is active.

Create a Message Set for CPF1817
If the message CPF1817, System utility power restored at &1. is received within the two minutes that the CPF1816 message is delayed by the message set, the following message set OPAL will end the delayed job. The page is not sent since the system now has power.

The OPAL code does the following:
-
Sequence 10, 20 and 30 determine the current state of the prior OPAL to see if the message set job for CPF1816 is still active. If the return value is 0, the job has ended, so this job also ends.

If the return value is 1, the message set job is still delayed and waiting to send a page, so the current job continues with OPAL processing.
-
Sequence 50 retrieves the Job Name of the message set OPAL job that will page.

-
Sequence 60 retrieves the User of the message set OPAL job that will page.

-
Sequence 70 retrieves the Job Number of the message set OPAL job that will page.

-
The OPAL code then executes the ENDJOB command, terminating the PAGE via Robot Alert that would have been sent if the system power had not been restored within the two-minute delay.

These examples illustrate how you can use Robot Console to set up an event and then terminate it if another event occurs within a specified time.