COND parameter is used to test return codes from previous job steps and determine whether to bypass or execute specified job steps. Return code is set based on the status of execution of a job. The return code can be a number between 0 (successful execution) to 4095 (non-zero shows error condition).
A job step execution can be controlled based on the return code of the previous step(s) using the COND parameter and IF-THEN-ELSE construct.
A COND parameter can be coded in the JOB or EXEC statement of JCL. It is a test on the return code of the preceding job steps. If the test is evaluated to be true, the current job step execution is bypassed. Bypassing is just an omission of the job step and not an abnormal termination. There can be at most eight conditions combined in a single test.
Instead of coding a JOB statement COND parameter, code an EXEC statement COND parameter when you want to:
Note: Depending on the program invoked, a test showing that a return code from a step is zero is not sufficient to verify that the step did not fail. The system can fail a step (or job) even if the return code is
If you code the COND parameter on the JOB statement and on one or more of the job’s EXEC statements, and if a return code test on the JOB statement is satisfied, the job terminates. In this case, the system does not process any subsequent EXEC statement COND parameters.
If the tests on the JOB statement are not satisfied, the system then performs the return code tests on the EXEC statement. If a return code test is satisfied, the step is bypassed.
COND=(rc,logical-operator) or (rc,logical-operator,stepname) or COND=EVEN or COND=ONLY
Rules:
Here is the description of parameters used:
Note: Specifying a decimal number greater than 4095 could result in invalid return code testing or invalid return codes in messages.
Types | Condition Example | Explanation |
Type 1 | COND=(0,EQ) | Is return code 0 equal to the return code from the previous step? If this condition is true then bypass this step. |
Type 2 | COND=(4,EQ,STEP10) | Is return code 4 equal to the return code from the previous step? if this condition is true then bypass this step. |
Type 3 | COND=EVEN | Run these steps even though, any of the previous steps has Abended. |
Type 4 | COND=ONLY | Run this step only if any of the previous steps has abended. |
Example
Test in COND parameter | Execute current step | Bypass current step |
COND=(code,GT) | code <= RC | code > RC |
COND=(code,GE) | code < RC | code >= RC |
COND=(code,EQ) | code ¬= RC | code = RC |
COND=(code,LT) | code >= RC | code < RC |
COND=(code,LE) | code > RC | code <= RC |
COND=(code,NE) | code = RC | code ¬= RC |
Note: When the COND parameter does not name a previous step, the system tests all previous steps. If any test is satisfied, the system takes action on the current step, per the char above.
When COND is coded in the JOB statement, the condition is tested for every job step. When the condition is true at any particular job step, it is bypassed along with the job steps following it. Following is an example:
//TESTJB01 JOB CLASS=1,NOTIFY=&SYSUID,COND=(8,LE) //* //STEP01 EXEC PGM=PGM01 //* STEP01 executes without any test being performed. ….. ….. //STEP02 EXEC PGM=PGM02 //* STEP02 is bypassed, if RC of STEP01 is 8 or above. //* Say STEP01 ends with RC4 and hence test is false. //* So STEP02 executes and lets say it ends with RC16. …….. …….. //STEP03 EXEC PGM=PGM03 //* STEP03 is bypassed since 8 < 16.
When COND is coded in EXEC statement of a job step and found to be true, only that job step is bypassed, and execution is continued from the next job step.
//TESTJB02 JOB CLASS=2,NOTIFY=&SYSUID //* //STEP01 EXEC PGM=PGM01 //* Assuming STEP01 ends with RC0. ….. ….. //STEP02 EXEC PGM=PGM02,COND=(0,EQ,STEP01) //* In STEP02, condition evaluates to TRUE and step bypassed. ….. ….. //STEP03 EXEC PGM=IEBGENER,COND=((10,LT,STEP01),(10,GT,STEP02)) //* In STEP03, first condition fails and hence STEP03 executes. //* Since STEP02 is bypassed, the condition (10,GT,STEP02) in //* STEP03 is not tested.
When COND=EVEN is coded, the current job step is executed, even if any of the previous steps abnormally terminate. If any other RC condition is coded along with COND=EVEN, then the job step executes if none of the RC conditions is true.
//TESTJB03 JOB CLASS=3,NOTIFY=&SYSUID //* //STEP01 EXEC PGM=PGM01 //* Assuming STEP01 ends with RC0. ….. ….. //STEP02 EXEC PGM=PGM02,COND=(0,EQ,STEP01) //* In STEP02, condition evaluates to TRUE and step bypassed. ….. ….. //STEP03 EXEC PGM=IEBGENER,COND=((10,LT,STEP01),EVEN) //* In STEP03, condition (10,LT,STEP01) evaluates to true, //* hence the step is bypassed.
When COND=ONLY is coded, the current job step is executed, only when any of the previous steps abnormally terminate. If any other RC condition is coded along with COND=ONLY, then the job step executes if none of the RC conditions is true and any of the previous job steps fail abnormally.
//TESTJB04 JOB CLASS=4,NOTIFY=&SYSUID //* //STEP01 EXEC PGM=PGM01 //* Assuming STEP01 ends with RC0. ….. ….. //STEP02 EXEC PGM=PGM02,COND=(4,EQ,STEP01) //* In STEP02, condition evaluates to FALSE, step is executed //* and assume the step abends. ….. ….. //STEP03 EXEC PGM=IEBGENER,COND=((0,EQ,STEP01),ONLY) //* In STEP03, though the STEP02 abends, the condition //* (0,EQ,STEP01) is met. Hence STEP03 is bypassed.
//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.
//TEST2 EXEC PGM=DUMPINT,COND=((16,GE),(90,LE,STEP1),ONLY)
The system executes this step ONLY if two conditions are met:
Therefore, the system executes this step only when all three of the following are true:
The system bypasses this step if any one of the following is true: • All preceding job steps terminated normally.
//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.
//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.
Read JCL blogs : Click Here. IBM Manual : Click Here
A well-maintained product backlog is crucial for successful product development. It serves as a single…
Incremental value to the customer refers to the gradual delivery of small, functional parts of…
A Product Market refers to the group of potential customers who might be interested in…
The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…
The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…
Choosing the right Scrum Master Certification depends on your current experience and career goals. If…