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


Example 6

z/OS MVS JCL Reference
SA23-1385-00

The following example shows two IF/THEN/ELSE/ENDIF statement constructs, one of which is nested in the ELSE clause of the other. The nested statements are indented so that they are easier to read.
//JOBE      JOB   ...
//PROC1     PROC
//PSTEPONE  EXEC  PGM=...
//          PEND
//PROC2     PROC
//PSTEPTWO  EXEC  PGM=...
//          PEND
//EXP1      EXEC  PROC=PROC1
//EXP2      EXEC  PROC=PROC2
//IFTEST4   IF  (EXP1.PSTEPONE.RC > 4) THEN
//STEP1ERR  EXEC  PGM=PROG1
//          ELSE
//IFTEST5     IF  (EXP2.PSTEPTWO.ABENDCC=U0012) THEN
//STEP2ERR    EXEC  PGM=PROG2
//            ELSE
//NOERR       EXEC  PGM=PROG3
//ENDTEST5    ENDIF
//ENDTEST4  ENDIF
//NEXTSTEP  EXEC  ...
Processing for the IF/THEN/ELSE/ENDIF construct named IFTEST4 is:
  1. If the relational-expression for IFTEST4 is true (the return code is greater than 4 for PSTEPONE in procedure PROC1, which is invoked by step EXP1), the system processes the THEN clause of IFTEST4. EXEC statement STEP1ERR invokes program PROG1. The system then passes control to ENDIF statement ENDTEST4, and processing continues with step NEXTSTEP.
  2. However, if the relational-expression for IFTEST4 is false (the return code is 4 or less for PSTEPONE in procedure PROC1, which is invoked by step EXP1), the system processes the ELSE clause of IFTEST4. It evaluates the IF/THEN/ELSE/ENDIF statement construct IFTEST5.
    Processing for the IF/THEN/ELSE/ENDIF construct named IFTEST5 is:
    1. If the relational-expression for IFTEST5 is true (the user-defined abend completion code is 0012 from PSTEPTWO in procedure PROC2, which is invoked by step EXP2), the system processes the THEN clause of IFTEST5. EXEC statement STEP2ERR invokes program PROG2. The system then passes control to ENDIF statement ENDTEST5, and then ENDTEST4. Processing continues with EXEC statement NEXTSTEP.
    2. However, if the relational-expression for IFTEST5 is false (that is, the user-defined abend completion code is not 0012 from PSTEPTWO in procedure PROC2, which is invoked by step EXP2), the system processes the ELSE clause of IFTEST5. EXEC statement NOERR invokes program PROG3. Processing then continues with step NEXTSTEP.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014