Step 4: Write the REXX Script
The value specified on the User Data Processing panel
(Figure 2) is accessed in the PIPE statement using the ACFFQRY command and stored in the variable
limit ( 1 ).
To issue the commands specified on the Command Processing panel (Figure 1), the ACFCMD command is used ( 2 ).
/* REXX */
/* debugging … */
…..
lrc = 0
/* Get the message from the safe */
"GETMLINE txt 1"
svmsgid = msgid()
svjobname = jobname()
Parse Var txt . type . ' IS ABOUT ' usage '% ' .
/* This sample recovers just type JRNL */
If type \= 'JRNL' Then Exit 0
/* Check the RECOVERY automation flag */
"AOCQRY "svjobname"."svmsgid" RECOVERY"
lrc = rc
Select
/* Automation allowed */
When lrc = 0 Then Do
/* Get TGlobal variable from AOCQRY */
"GLOBALV GETT SUBSAPPL"
/* Get the user-data from the ACF */
"PIPE (STAGESEP | NAME GETUDATA)" ,
"NETV ACFFQRY "subsappl","svmsgid , 1
"| SEPARATE" ,
"| LOCATE 1.6 /LIMIT=/" ,
"| EDIT 7.2 1" ,
"| VAR limit"
/* If no limit was defined use default */
If symbol('limit') = 'LIT' Then limit = '95'
/* Check if limit is exeeded. If so, issue commands */
If usage >= limit Then Do
"ACFCMD MSGTYP="svmsgid 2
lrc = rc
/* Error occured ? */
If lrc \= 0 Then Do
…
End
End
/* Automation not allowed */
When lrc < 3 Then Do
…
End
/* Resource not known to SA */
When lrc = 3 Then Nop
/* Error occured */
Otherwise Do
…
End
End
Exit lrc