As the writeups above explain, JCL allows batch executions
A job can have one or more steps, each running a program or other JCL procedure
, which will run in sequential
order from the first to the last.
As McSnarf mentioned above, JCL allows conditioning the running of steps according to the return code
s returned by steps which have already run.
What's this good for?
Well, let's say you have a job that runs 2 steps on a file containing code. The first step compiles
the code and the second step links the compiled load module
with other (NCAL
) procedures. In case the compilation step didn't finish validly (syntax error
for example) there's not much point in running the linkage
These conditions are called 'CONDS' and are written in the EXEC
cards of steps you wish to add a condition to (steps with no conds will always run).
's Conds follow sone twisted logic
Instead of the normal "if true then run" logic we're used to, IBM decided to do the opposite, so steps with conditions that resolve to true are NOT
The syntax is as follows:
//STEP1 EXEC PGM=SOMEPGM,COND=(<rc>,<operator>,<stepname>)
Where rc is the return code we're checking, stepname is the step we're checking the return code of and operator is one of the following:
EQ - Equal to (==)
NE - Not equal to (!=)
LT - Less than (<)
LE - Less than or equal to (<=)
GT - Greater than (>)
GE - Greater than or equal to (>=)
NG - Not greater than (<=)
NL - Not less than (>=)
(Omitting the step name parameter from the COND will make it check the return code of every step that finished running before the current step.)
//STEP3 EXEC PGM=PROGGIE,COND=(3,LE,STEP1)
Means that step 3 won't
be executed if:
3 <= STEP1
Which means STEP3 will
run if 3 > STEP1 ==> STEP1 < 3.
Or in other words, STEP3 will run only if STEP1 returned a return code of less than 3.
As you see, the order of the parameters is also unconveniently backwards.
Fun stuff eh?
Cond has another format which works with the EVEN and ONLY parameters:
makes it so the step will run even if any of the steps above it abend
runs the step only if a previous step has failed or abend
Eventually, IBM realised their wrong doings with conds and implemented normal if-then-else
statements in JCL
which make life so much easier.
A few years too late imo..