Example 9
The following example specifies that if STEP1 does not abend, the
system is to run STEP2 and STEP3. Otherwise it is to run STEP4.
//JOBF JOB ...
//STEP1 EXEC PGM=...
//IFTEST6 IF ¬ABEND THEN
//STEP2 EXEC PGM=...
//STEP3 EXEC PGM=...
// ELSE
//STEP4 EXEC PGM=...
// ENDIF
The determination of which steps to run is made when the IF/THEN/ELSE/ENDIF statement construct is processed immediately after STEP1 executes. This determination is not subject to change based on the results of running steps after STEP1.
Thus, if STEP1 does not abend, even if STEP2 does, STEP3 (and not STEP4) still runs. If, however, STEP1 does abend, STEP4 is the next step to run, as prescribed by the ELSE clause.