IF / ENDIF purpose - narrative



In the context of the life of JCL, then the IF / ENDIF construct is relatively new, as the very earliest releases from the 1960s through to the 1990s only supported the COND= operand on both the JOB and EXEC statements.

The COND= operand was aimed at bypassing steps and hence has convoluted logic. If JCL is being written from scratch then the recommendation would be to use IF / ENDIF constructs. Unfortunately there is a great deal of JCL in existence which uses COND= for no other reason than the JCL itself has existed for a long time and has not been re-written.

IF / ENDIF Purpose - narrative



When JCL was introduced in 1964 it supplied the COND operand to facilitate the bypassing of a job step depending upon the outcome of a preceding job step or steps. Because it facilitated bypassing the logic associated with constructing a valid COND argument was not obvious.

The IF/ELSE/ENDIF Statements were introduced in the 1990s and facilitate the inclusion, rather than exclusion, of a job step based on the outcome of a preceding step or steps. This principle, plus the fact that they work in a similar way to IF statements in most other programming or scripting languages makes them easier to understand and use.

The IF statement also allows the testing of more criteria than the COND operand making them a more comprehensive tool.

Copyright © Legac-e Education 2002-