Program monitoring - 2
The third example illustrates the use of the TERM macro, via which a user-defined return code can be entered in the job variable monitoring the program.
In the event of an error, a program PROG1 sets the monitoring job variable to a value greater than 1. The user can then interrogate this value in order to decide whether or not it is practical to have a further program PROG2 executed. It should be noted that the status indicator (3 character positions) is set by the system, with the result that the value updated by the user begins in position 4. The length of this value is 4 characters. If PROG2 is to be started by a different job, then PROG2 must first wait for the end of program PROG1:
/WAIT-EVENT UNTIL=*JV(CONDITION=((ERROR,1,2)=C'$T') OR ((ERROR,1,2)=C'$A'),
TIME-LIMIT=...,TIMEOUT-LABEL=...)
Program PROG1
PROG1 START : FEHL3 LR R9,R15 : TERM URETCD=(R9) ——————————————————————————————————————————————— (1) END : / SET-LOGON-PARAMETERS JOB-NAME=BEISP3 / SET-JV-LINK JV-NAME=ERROR / START-ASSEMBH // COMPILE SOURCE=PROG1,... // END / START-EXE FROM-FILE=*OMF,MONJV=ERROR —————————————————————————— (2) / SET-JOB-STEP / SKIP-COMMANDS TO-LABEL=EXIT,IF=*JV(CONDITION=((ERROR,4,4)>C'0001') / START-EXE FROM-FILE=PROG2 /.EXIT EXIT-JOB
(1) | The URETCD operand in the TERM macro ensures that the contents of the specified register are edited and stored to the fourth decimal place in the programmonitoring job variable after the status indicator, in bytes 4-7 of the value field (see also the “Executive Macros” manual [4]). |
(2) | As of BLSSERV V2.3, the START-PROGRAM command is replaced by the START-EXECUTABLE-PROGRAM command |