How to resubmit a job once if it fails on a particular return code in a particular step after x minutes.
search cancel

How to resubmit a job once if it fails on a particular return code in a particular step after x minutes.

book

Article ID: 55335

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

Objective: Resubmit job A when it fails in step name STEP02 with a return code 04.

Resolution

1. Update the Job Tracking Definition Table (JTDT) so that job A is tracked under its model:
        TRACKDEF JOB NAME(A) MODEL(TEST)

2. Create the tracking model:
       DEFTM TEST STEPFAILEVENT(hlq.RESUB)

3. Create the event hlq.RESUB:
      EVENT ID(<prefix>.RESUB) SYSTEM(ESP) REPLACE INVOKE 'hlq.PROCLIB(RESUB)' ENDDEF

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.