The example in Figure 112 demonstrates how a rule can issue a command and analyze the results of the command request.
Figure 112 Example of Issuing a Command and Analyzing the Response
ON EVENT = EVERY10
OWNER IOAADMIN GROUP MODE LOG RUNTSEC
THRESHOLD
DESCRIPTION ISSUE A COMMAND AND GET ITS RESPONSE
===========================================================================
DO SET = %%MYSTC = CICSTEST GLOBAL N
DO SET = %%JSTAT = INACTIVE GLOBAL N
/* ALL STATEMENTS UP TO THE 'ENDMSG' ARE EXECUTED FOR EACH LINE
/* OF THE COMMAND'S RESPONSE
DO COMMAND = D A,%%MYSTC
WAIT CONSOLEID CONSOLE SYSTEM
WAITMODE Y WAITRESP Y TIMEOUT
RESPMSG
IF %%$W2 %%$M* EQ %%MYSTC
DO SET = %%JSTAT = ACTIVE GLOBAL N
ENDIF
DO DISPLAY = SUPPRESS Y ROUTE DESC CONSOLEID CONSOLE
SYSTEM
ENDMSG
/* ALL STATEMENTS AFTER THE 'ENDMSG' ARE EXECUTED AFTER ALL THE
/* LINES OF THE COMMAND RESPONSE WERE PROCESSED
IF %%JSTAT NE ACTIVE
DO SHOUT = TO OPER URGENCY R SYSTEM CTO282I
MESSAGE %%MYSTC IS NOT ACTIVE - CHECK WHY
ENDIF
===========================================================================
DAYS DCAL
AND/OR
WDAYS ALL WCAL
MONTHS 1- Y 2- Y 3- Y 4- Y 5- Y 6- Y 7- Y 8- Y 9- Y 10- Y 11- Y 12- Y
DATES
CONFCAL SHIFT
ENVIRONMENT SMFID SYSTEM
===========================================================================
IN
TIME FROM UNTIL INTERVAL 010 PRIORITY CONTINUE SEARCH Y
FILL IN RULE DEFINITION. CMDS: EDIT, SCHED, OPT, SHPF 17.02.57
Explanation
This rule checks the status of a specified job (CICSTEST) every ten minutes. If the job is not active, a message is sent to notify the operator of the problem. The rule works as follows:
ON EVENT...
Since ON EVENT is specified for the rule, the rule is triggered immediately when runtime criteria are met. The specified runtime criteria, a value of 010 specified for the INTERVAL parameter, indicates that the rule is triggered every ten minutes.
DO SET=%%MYSTC = CICSTEST
DO SET=%%JSTAT = INACTIVE
Two local variables are set using the above statements at the beginning of this rule:
DO COMMAND=D A,%%MYSTC
The rule issues this command to obtain information on the job specified in the %%MYSTC variable (CICSTEST). If the name of the job is contained in the response to the command, it indicates that the specified job is active.
IF %%$W2 %%$M* EQ %%MYSTC
DO SET=%%JSTAT = ACTIVE
This IF statement checks if the second word (%%$W2) in the current command response line (%%$M*) is the job name (%%MYSTC). If the second word in the current command response line is the job name (CICSTEST), the %%JSTAT variable is set to ACTIVE. Since the response to this command is usually more than one line, the ENDMSG parameter is specified to ensure that the IF statement is applied to each line of the command response.
IF %%JSTAT NE ACTIVE
DO SHOUT = = TO OPER URGENCY R SYSTEM CTO282I
MESSAGE %%MYSTC IS NOT ACTIVE - CHECK WHY
When the last line of the command response is detected, this IF statement checks if the %%JSTAT user-defined variable now contains the value ACTIVE. If %%JSTAT does not contain the value ACTIVE, this indicates that the job name was not located in the command response and the operator is notified that the job is inactive.
Note: The %%MYSTC variable is used to contain the name of the job to be checked so that the rule can be used to check other jobs by changing only the specification of the job name in the statement at the beginning of the rule (DO SET=%%MYSTC = ).
Parent Topic |