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


Examples of the COND parameter

z/OS MVS JCL Reference
SA23-1385-00

Example 1:
//STEP6  EXEC PGM=DISKUTIL,COND=(4,GT,STEP3)

In this example, if the return code from STEP3 is 0 through 3, the system bypasses STEP6. If the return code is 4 or greater, the system executes STEP6. Because neither EVEN nor ONLY is specified, the system does not execute this step if a preceding step abnormally terminates.

Example 2:
//TEST2  EXEC PGM=DUMPINT,COND=((16,GE),(90,LE,STEP1),ONLY)
The system executes this step ONLY if two conditions are met:
  1. A preceding job step abnormally terminated.
  2. No return code tests are satisfied.
Therefore, the system executes this step only when all three of the following are true:
  • A preceding job step abnormally terminated.
  • The return codes from all preceding steps are 17 or greater.
  • The return code from STEP1 is 89 or less.
The system bypasses this step if any one of the following is true:
  • All preceding job steps terminated normally.
  • The return code from any preceding step is 0 through 16.
  • The return code from STEP1 is 90 or greater.
Example 3:
//STEP1  EXEC  PGM=CINDY
          .
          .
//STEP2  EXEC  PGM=NEXT,COND=(4,EQ,STEP1)
          .
          .
//STEP3  EXEC  PGM=LAST,COND=((8,LT,STEP1),(8,GT,STEP2))
          .

In this example, if STEP1 returns a code of 4, STEP2 is bypassed. Before STEP3 is executed, the system performs the first return code test. If 8 is less than the return code from STEP1, STEP3 is bypassed; or, restated, if the STEP1 return code is less than or equal to 8, STEP3 is executed. Because 4 is less than 8, STEP3 is executed.

The system does not perform the second return code test because STEP2 was bypassed.

Example 4:
//STP4  EXEC PROC=BILLING,COND.PAID=((20,LT),EVEN),
//     COND.LATE=(60,GT,FIND),
//     COND.BILL=((20,GE),(30,LT,CHGE))

This statement calls cataloged or in-stream procedure BILLING. The statement specifies different return code tests for each of the procedure steps: PAID, LATE, and BILL. The system executes step PAID even if a preceding step abnormally terminates unless the accompanying return code is satisfied.

Example 5: The procedure TEST exists in SYS1.PROCLIB:
//TEST      PROC
//PROCSTP1  EXEC PGM=IEFBR14,COND=(0,NE)
//PROCSTP2  EXEC PGM=IEFBR14,COND=(0,NE)
//PROCSTP3  EXEC PGM=IEFBR14
//PROCSTP4  EXEC PGM=IEFBR14,COND=(4,LT)
//          PEND
The job:
//JOB1      JOB...RESTART=JOBSTEP
//JOBSTEP   EXEC PROC=TEST

JOB1 restarts at JOBSTEP. PROCSTP1 is the first step in the job because of the RESTART specification, and the COND parameter test is not valid because no previous steps have run. Therefore, the system evaluates the COND parameter for PROCSTP1 as false, and PROCSTP1 runs. PROCSTP3 has no COND parameter. The COND parameters for PROCSTP2 and PROCSTP4 are used.

The job:
//JOB1      JOB...RESTART=JOBSTEP.PROCSTP2
//JOBSTEP   EXEC PROC=TEST,COND=(8,GT)

JOB1 restarts at PROCSTP2 as called by JOBSTEP. The COND parameter on JOBSTEP does not specify a procstepname qualifier and therefore applies to all steps in procedure TEST. The system evaluates the COND parameter for PROCSTP2, the restart step, as false, and the step runs. However, the COND parameter for steps PROCSTP3 and PROCSTP4 evaluates as true (because 8 is greater than the return code of 0 provided by all previous steps in the job), and the steps are bypassed.

The job:
//JOB1      JOB...RESTART=JOBSTEP.PROCSTP2
//JOBSTEP   EXEC PROC=TEST,COND.PROCSTP4=(8,GT)

JOB1 restarts at PROCSTP2 as called by JOBSTEP. Because of the RESTART specification, PROCSTP2 is the first step in the job. The system evaluates the COND parameter for PROCSTP2 as false, and the step runs. PROCSTP3 has no COND parameter. PROCSTP4 is overridden as specified on JOBSTEP.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014