Make your own free website on Tripod.com
DocBag

Back Issue

JCL IF Statement Revisited

The condition portion of this statement is somewhat underdocumented. It can consist of an expression which evaluates to 'TRUE' or 'FALSE' or a comparison of two values. The two values being compared must be of the same type: The operators can:

Here is an example of what can be done:

// SET ABCLEAN='TRUE' //COPY EXEC PGM=MYPGM .... // IF (ABEND = &ABCLEAN | COPY.RC > 8) THEN //FINAL EXEC PGM=CLEANUP .... // ELSE //CLEAN EXEC PGM=LASTPGM .... // ENDIF // As it stands, the cleanup program runs if any step abends or the return code from the COPY step is greater than 8. However, if the setting for ABCLEAN is changed to FALSE, then the cleanup program will not run if any step abends.

Another possibility is:

.... // SET RUNFIN='FALSE' // IF &RUNFIN THEN //FINAL EXEC PGM=CLEANUP .... // ENDIF In this example, the final step will not execute. The setting for RUNFIN could be altered to TRUE to change this behaviour. Note that an IF statement or COND parameter test does not prevent the first step in a job from running.

Feedback

Comments or suggestions can be sent to the author.

Last Month's Topic

Big Iron