CoreJcl
Conditional steps done clearly
IF/THEN/ELSE instead of COND, with a notification path on failure.
//CONDJOB JOB (ACCT01),'CONDITIONAL',CLASS=A,MSGCLASS=X //EXTRACT EXEC PGM=PAYEXTR //SYSOUT DD SYSOUT=* //* //IF (EXTRACT.RC = 0) THEN // LOAD EXEC PGM=PAYLOAD // SYSOUT DD SYSOUT=* //ELSE // ALERT EXEC PGM=IEBGENER // SYSUT1 DD * PAYEXTR FAILED - LOAD SKIPPED - CALL PRODUCTION SUPPORT /* // SYSUT2 DD SYSOUT=* // SYSIN DD DUMMY //ENDIF //* //* a cleanup step that runs whatever happened //IF (ABEND | ~ABEND) THEN // CLEAN EXEC PGM=IEFBR14 // TMP DD DSN=&&WORK,DISP=(MOD,DELETE,DELETE), // SPACE=(TRK,(1,1)),UNIT=SYSDA //ENDIF
The IF construct can test a step's return code, whether it abended (ABEND, ~ABEND), or whether it ran at all (RUN, ~RUN). It is far clearer than COND and should be preferred for new work.
Stuck on something else?
Ask the community or search the full course.