Example 7
The following example shows an IF/THEN/ELSE/ENDIF statement construct
with a deferred checkpoint restart.
//DEFER1 JOB RESTART=(STEP2,CHECK004)
//STEP1 EXEC PGM=IEFBR14
//IF1 IF STEP1.RC=0 | ¬STEP1.RUN THEN
//STEP2 EXEC PGM=DEBIT1
//STEP3 EXEC PGM=CREDIT1
//STEP4 EXEC PGM=SUMMARY1
// ELSE
//STEP5 EXEC PGM=DEBIT2
//STEP6 EXEC PGM=CREDIT2
//STEP7 EXEC PGM=SUMMARY2
// ENDIF
Processing for the IF/THEN/ELSE/ENDIF construct named IF1 is as
follows:
- The conditions on statement IF1 will be checked before executing STEP2.
- STEP1.RC=0 tests false because STEP1 did not execute and cannot be correctly evaluated.
- ¬STEP1.RUN tests true; therefore, STEP2, STEP3, and STEP4 will execute and STEP5, STEP6, and STEP7 will not execute.
Note: Without the ¬STEP.RUN condition, STEP2, STEP3,
and STEP4 would not execute and STEP5, STEP6, and STEP7 would execute.