Bag

Back Issue

Condition Code Checking

The objective is to define when a program should run based on what the results were from earlier JCL steps. Of course, some people are still attached to the JCL COND parameter which actually specifies when you don't want the program to run. However, in most cases, IF THEN,ELSE,ENDIF JCL statements are easier to code correctly and let you do things which would be difficult to achieve with the old COND parameter.

Here is a sample JCL fragment:

//COPY EXEC PGM=MYPGM .... // IF (COPY.RC = 0) THEN //NEXT EXEC PGM=NEXTPGM .... // IF (ABEND | NEXT.RC > 8) THEN //FINAL EXEC PGM=CLEANUP .... // ELSE //CLEAN EXEC PGM=LASTPGM .... // ENDIF // ENDIF // If the first program runs with return code zero, then program NEXTPGM is run. If that program issues a return code greater than 8 or an earlier step has abended, then program CLEANUP is run. Otherwise, LASTPGM is run.

You can also test what the abend code value was or whether a specific job step executed.

Feedback

Comments or suggestions can be sent to the author.

Big Iron