Automatic recovery processing and data set cleanup

If a failing job operation has a cleanup action defined and it contains automatic recovery statements requiring a job restart, cleanup action is performed before automatic recovery. The process is as follows:
  1. The automatic recovery function detects the recovery statements and check the type of cleanup.
  2. If the cleanup type is set to None, the recovery actions are immediately performed. If the cleanup type is set to Immediate or Manual, the recovery actions are postponed.
  3. For the immediate cleanup type, the cleanup actions are started automatically by the scheduler. For the manual cleanup type, you need to request the cleanup actions by selecting the Start Cleanup with AR option.
  4. Automatic recovery processing waits until after HCL Workload Automation for Z finishes the data set cleanup. When the cleanup status is set to Complete, the recovery actions are performed.

    If the cleanup type is set to Automatic, no recovery action is taken and an error message is issued.

If you specify the other cleanup types, manual or automatic, the recovery action does not occur and an error message is issued.
If you defined RESSTEP as an automatic recovery statement in the JCL, HCL Workload Automation for Z performs the cleanup action according to the RESSTEP instructions. This means that the RESSTEP is considered as the starting step and the last step is considered as the ending step. If, after all the automatic recovery actions are performed, the operation fails again, a stand-alone cleanup action is started based on the value set in RCLOPTS IMMEDLOGIC:
  • If IMMEDLOGIC(BESTSTEP), the action starts from the best step
  • If IMMEDLOGIC(FIRSTSTEP), the action starts from the first step
For detailed information about the RCLOPTS statement, see the Customization and Tuning.

In some situations, you might decide to create a logic for job runs that bypasses the need for data set cleanup. You do not have to wait for the cleanup, because automatic recovery adds a new occurrence, which does not depend on the cleanup of the data set. When you specify in the AROPTS initialization statement the CHKRESTART(Y) parameter, the recovery actions are executed immediately whether or not data set cleanup is required.

Example of data set Cleanup with Automatic Job Recovery shows how data set cleanup and automatic recovery can work together to ensure that a job is cleaned up and restarted.

Figure 1. Example of data set Cleanup with Automatic Job Recovery
//*
//*%OPC RECOVER ERRSTEP=STEPFAIL,JOBCODE=JCL,DELSTEP=STEPFAIL
//*%OPC SCAN
//STEP1    EXEC PGM=IEFBR14
//DD1  DD  DSN=EID.EID4R2.CATTEST,DISP=(,CATLG),
//         UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
//         DCB=(RECFM=FBA,LRECL=121,BLKSIZE=12100)
//STEPFAIL EXEC PGM=IEFBR14
//DD3  DD  DSN=DSN.NOT.CATLG,DISP=(OLD,DELETE,DELETE)
//STEP2 EXEC PGM=IEFBR14
//DD2  DD  DSN=EID.EID4R2.CATTEST,DISP=(OLD,DELETE,DELETE)
//

In Example of data set Cleanup with Automatic Job Recovery, the job is designed to fail in STEPFAIL with a JCL error. Automatic recovery statements specify that when this error occurs, the step is to be deleted and the job rerun. Without data set cleanup, the job fails immediately in STEP1 with a JCL error: duplicate data set. When cleanup is active for the operation, the automatic recovery action is postponed until the cleanup action is completed or discarded.

For more information, see Restart and cleanup.