JCL Conditional Parameter Types
COND=(0, EQ)
This tells JCL: If the previous step’s return code (RC) was zero (no errors), skip this step.
Example:
//STEP1 EXEC PGM=IGYCRCTL //* Compile the program
//STEP2 EXEC PGM=TESTPROG //* Run tests
//STEP3 EXEC PGM=COPYOUT //* Copy output if tests pass
//STEP4 EXEC PGM=PRTERRPT, COND=(0,EQ) //* Print error report only if STEP3 failed
Explanation:
STEP1: Try to compile program.
STEP2: Run tests.
STEP3: Copies the output but only if compilation and tests worked
STEP4: Prints an error report if STEP3 failed (RC not 0). If STEP3 worked (RC=0), STEP4 is skipped.
COND=EVEN
This tells JCL: Run this step even if something above failed or abended.
Example:
//STEP1 EXEC PGM=IGYCRCTL //* Compile the program
//STEP2 EXEC PGM=TESTPROG //* Run tests
//STEP3 EXEC PGM=COPYOUT //* Copy output
//STEP4 EXEC PGM=PRTERRPT, COND=EVEN //* Always print error report (even on abend/failure)Explanation:
STEP1: Try to compile program
STEP2: Runs tests.
STEP3: Copies output.
STEP4: The error report always runs, even if a previous step abend or failure.
COND=ONLY
This tells JCL: Run this step only if something above failed or abended.
Example:
//STEP1 EXEC PGM=IGYCRCTL //* Compile the program
//STEP2 EXEC PGM=TESTPROG //* Run tests
//STEP3 EXEC PGM=COPYOUT //* Copy output
//STEP4 EXEC PGM=PRTERRPT, COND=ONLY //* Print error report only if previous step is failed or abendedExplanation:
STEP1: Try to compile program
STEP2: Runs tests.
STEP3: Copies output.
STEP4: Runs only if any previous step (STEP1, STEP2, STEP3) failed or abended.
COND=(4095,LT)
This tells JCL: If the previous step’s return code (RC) was less than 4095, skip this step. Since the maximum possible RC is 4095, this condition means the step will never be skipped, and so this step will almost always execute
Example:
//STEP1 EXEC PGM=IGYCRCTL //* Compile the program
//STEP2 EXEC PGM=TESTPROG //* Run tests
//STEP3 EXEC PGM=COPYOUT //* Copy output
//STEP4 EXEC PGM=PRTERRPT, COND=(4095,LT) //* Error report always runs because RC never exceeds 4095Explanation:
STEP1: Try to compile the program.
STEP2: Run tests.
STEP3: Copy the output.
STEP4: Prints an error report every time, because RC from STEP3 will always be less than or equal to 4095, so the skip condition is never met.
COND=(4, EQ, STEP2)
This tells JCL: If STEP2’s return code (RC) was 4 (a warning), SKIP this step.
Example:
//STEP1 EXEC PGM=IGYCRCTL //* Compile the program
//STEP2 EXEC PGM=TESTPROG //* Run tests
//STEP3 EXEC PGM=COPYOUT //* Copy output
//STEP4 EXEC PGM=PRTERRPT, COND=(4,EQ,STEP2) //* Print error report except for STEP2 RC=4Explanation:
STEP1: Try to compile the program.
STEP2: Run tests.
STEP3: Copy the output.
STEP4: Prints an error report if STEP2 did NOT finish with RC=4.
If STEP2 returned RC=4 (just a warning), STEP4 is skipped and no error report is generated.
If STEP2 returned any other code (0, 8, 12,..), STEP4 runs and prints the error report
Last updated
Was this helpful?