Examples
Example 1
This example shows the relationship between ACFCMD and the automation control file. The message to automate, $HASP607, is produced by the JES2 subsystem and indicates that JES2 is not dormant. The automation procedure responds to this by calling ACFCMD to issue a command to stop the JES2 initiators, (MVS $PI).
The command is defined in the automation policy through the customization dialog panels.
DISPACF JES2 $HASP607, a panel with information similar to
the following panel is displayed.
Command = ACF ENTRY=JES2,TYPE=$HASP607,REQ=DISP
SYSTEM = KEY3 AUTOMATION CONFIGURATION DISPLAY - ENTRY= JES2
-------------------------------------------------------------------------------
AUTOMATION CONFIGURATION DISPLAY - ENTRY= JES2
TYPE IS $HASP607
CMD = (,,'MVS $PI')
END OF MULTI-LINE MESSAGE GROUP
/* REXX CLIST to automate $HASP607 */
/* Check whether automation allowed and set TGLOBALs */
'AOCQRY ...'
:
'ACFCMD MSGTYP=$HASP607,ENTRY=JES2'
Select
When rc = 0 Then Nop /* Command issued OK */
When rc = 1 Then Do /* No commands issued; warn if required */
:
End
Otherwise Do /* Error; perform warning action */
:
End
End
ExitACFCMD uses the parameters passed to it to find the corresponding values in the automation policy. Because no SEL parameter is coded, no selection restriction is made with respect to the first field of the command entry.
Upon return to the automation procedure, the rc special variable is
checked to ensure a command was found in the automation control file. The automation
procedure takes appropriate action if a command is not found or a processing error occurs in
the ACFCMD command.
Example 2
This example uses the same scenario as Example 1, but shows how you can use defaults to minimize coding. The message to automate, $HASP607, is produced by the JES2 subsystem and indicates that JES2 is not dormant. The automation procedure responds by calling ACFCMD to issue a command to stop the JES2 initiators ($PI).
The command is defined in the automation policy as in Example 1.
/* REXX CLIST to automate $HASP607 */
/* Check whether automation allowed and set TGLOBALs */
'AOCQRY ...'
:
'ACFCMD MSGTYP='Msgid()
Select
When rc = 0 Then Nop /* Command issued OK */
When rc = 1 Then Do /* No commands issued; warn if required */
:
End
Otherwise Do /* Error; perform warning action */
:
End
End
ExitThis example differs from Example 1 in the following ways:
- ACFCMD uses a NetView REXX function for the MSGTYP field, assumes defaults for the ENTRY and SEL fields and uses task global variables set up by AOCQRY for the ENTRY default.
- The ENTRY field defaults to JES2 because the job name on the message was the job name for the JES2 subsystem, so the SUBSAPPL task global (which is the default entry type) currently contains JES2. The AOCQRY command must be called before ACFCMD for the ENTRY default to work correctly.
- The MSGTYP field uses the NetView REXX
function
Msgid(), which contains the message identifier for the message that called the automation procedure. This message identifier is supplied only to an automation procedure called from the NetView automation table. This value can be used when calling ACFCMD.
ISSUECMD AUTOTYP=TERMINATEExample 3
This example shows the use of PASSnn logic in an automation procedure. The message to automate, $HASP607, is produced by the JES2 subsystem and indicates that JES2 is not dormant. The automation procedure responds the first time by stopping the JES2 initiators ($PI command), and the second time by abending JES2 ($P JES2,ABEND).
AUTOMATION CONFIGURATION DISPLAY - ENTRY= JES2
TYPE IS $HASP607
CMD = (PASS1,,'MVS $PI')
CMD = (PASS2,,'MVS $P JES2,ABEND')
END OF MULTI-LINE MESSAGE GROUP
/* REXX CLIST to automate $HASP607 */
/* Check whether automation allowed and set TGLOBALs */
'AOCQRY ...'
:
/* Increase the counter unique to this automation procedure */
'GLOBALV GETC HASP607_CNT'
If hasp607_cnt = " Then hasp607_cnt = 1
Else hasp607_cnt = hasp607_cnt + 1
'GLOBALV PUTC HASP607_CNT'
/* Issue the ACF command for the pass number as determined */
'ACFCMD MSGTYP='Msgid()',SEL=PASS'hasp607_cnt
Select
When rc = 0 Then Nop /* Command issued OK */
When rc = 1 Then Do /* No commands issued; warn if required */
:
End
Otherwise Do /* Error; perform warning action */
:
End
End
ExitThis example differs from the previous examples in the following ways:
- The automation procedure uses a unique common global variable, in this case HASP607_CNT,
to maintain a PASS counter. The automation procedure adds 1 to this counter each time it
is processed, then appends the counter to the SEL=PASS field. During processing, the
counter is translated, and PASS1 or PASS2 is processed. Note that a null test is required
to set the counter to 1 if it has not been set before. If the counter exceeds 2 then the
ACFCMD will set a return code of 1 since there is no matching entry in the automation
control file. Note: This example assumes you are using one JES subsystem. If you are using multiple JES subsystems, you must use a different counter variable for each.
- Another automation procedure that resets the counter is necessary to complete the logic
flow. For this example, the automation procedure runs when the final JES2 message or a
startup message is received. Note that the counter is cleared rather than set to zero.
This saves an entry in the NetView global
dictionary unless the message $HASP607 has occurred. The automation procedure to reset the counter is:
/* REXX CLIST to reset the counter */ hasp607_cnt = '' 'GLOBALV PUTC HASP607_CNT' Exit
- To ensure serialization of access to the NetView global dictionary and the correct ordering of the commands issued, the NetView automation table entry should route the command to a specific operator if the message may occur more than once in quick succession.
- If AOCQRY is checking the Terminate flag this example could be coded as:
ISSUECMD AUTOTYP=TERMINATE,PASSES=YES
Example 4
This example shows the use of EHKVARn variables. It also shows the use of duplicate selection fields because two entries are coded, each with PASS1. The message to automate is given in response to the JES2 $DU command, which displays all JES2 devices. The message ID produced by JES2 is $HASP628. The example assumes the full text of the message is passed to the automation procedure. The automation procedure checks the resource type, and if the resource is a line, stops the line using the $P LINEnn command, then stops current activity with a restart command, $E LINEnn.
The commands are defined in the automation policy through the customization dialog panels. The data is stored in the automation control file in the following way:
AUTOMATION CONFIGURATION DISPLAY - ENTRY= JES2
TYPE IS $HASP628
CMD = (PASS1,,'MVS $P &EHKVAR1')
CMD = (PASS1,,'MVS $E &EHKVAR1')
END OF MULTI-LINE MESSAGE GROUP
/* REXX CLIST to automate $HASP628 */
/* Check whether automation allowed and set TGLOBALs */
'AOCQRY ...'
:
/* Assign EHKVAR1 to parameter 2 (resource name on $HASP628 msg)
then determine whether the first characters are LINE, if not, exit */
ehkvar1 = Msgvar(2)
If Left(ehkvar1,4) <> 'LINE' Then Exit
'GLOBALV PUTT EHKVAR1'
'ACFCMD MSGTYP='Msgid()',SEL=PASS1'
Select
When rc = 0 Then Nop /* Command issued OK */
When rc = 1 Then Do /* No commands issued; warn if required */
:
End
Otherwise Do /* Error; perform warning action */
:
End
End
Exit
Following are the processing steps the automation procedure performs:
- The EHKVAR1 variable is assigned the value in the second parameter sent to the automation procedure, which for the $HASP628 message is the resource type
- The automation procedure verifies that the resource type is a LINE, then sets the variable to a task global variable and calls ACFCMD
- Assuming the second parameter is LINE21, two commands are issued from this automation
procedure:
$P LINE21 $E LINE21.