z/OS MVS JCL Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Example 8

z/OS MVS JCL Reference
SA23-1385-00

The following example shows an IF/THEN/ELSE/ENDIF statement construct with a deferred step restart.
//DEFER2 JOB RESTART=(STEP3)
//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:
  1. The conditions on statement IF1 will be checked before executing STEP3.
  2. STEP1.RC=0 tests false because STEP1 did not execute and cannot be correctly evaluated.
  3. ¬STEP1.RUN tests true; therefore, STEP3 and STEP4 will execute and STEP5, STEP6, and STEP7 will not execute.
Note: Without the ¬STEP1.RUN condition, STEP3 and STEP4 would not run, and STEP5, STEP6, and STEP7 would run.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014