Objective: Resubmit job A when it fails in step name STEP02 with a return code 04.
4. Create the procedure hlq.PROCLIB(RESUB):
TIME='REALNOW PLUS 5 MINUTES'
IF %MNSTEP='STEP02' AND %MNMXRC='4' AND %MNRRJOB EQ '' THEN DO
ESPNOMSG AJ %MNJOB HOLD APPL(%MNAPPL..%MNAPPLGEN)
ESPNOMSG AJ %MNJOB RESUBMIT APPL(%MNAPPL..%MNAPPLGEN)
ESPNOMSG AJ %MNJOB RESET DELAYSUB('%TIME') APPL(%MNAPPL..%MNAPPLGEN)
ESPNOMSG AJ %MNJOB RELEASE APPL(%MNAPPL..%MNAPPLGEN)
ENDDO
If the monitored job (A) gets a return code of 4 in step STEP02 and the job is not a rerun then the job will be held, resubmitted, have a delaysub of five minutes added to it and then will be released.