JCL COND

JCL - CLASS JCL - DSENQSHR

Advertisements


Condition parameter is used to decide execution of the JOB based on the return code.

And also COND parameter used to specify the return code validation the system uses to determine whether a job will continue processing or not.

COND parameter can be coded at JOB level and Step level.

COND parameter is optional parameter.

Maximum 8 conditions can be coded in single COND.

More than one condition is separated by comma (,).

If COND coded at job level and the coded condition is false, system executes the job.

If COND coded at job level and the coded conditioned is true, system bypass the job execution and terminates the job.

COND parameter is used to override the system default sequence of execution.

Bypassing the job based on the return code is not equal to terminating a job abnormally.

The COND parameter cannot have a null value.


Syntax:

COND=(return-code/RC,operator/RO)
COND=((return-code/RC,operator/RO)[,(return-code/RC,operator/RO)]...)

RC/Return-code: In the above syntax, RC is the Return code of precious step.

The valid RC values are from 0 to 4095.

RO/Operator: RO is the relational operator used to validate the return code.

The valid Relational Operator is like below

OperatorMeaning
GTGreater than
GEGreater than or equal to
EQEqual to
LTLess than
LELess than or equal to
NENot equal to

COND= (RC, RO) is used to execute the step with COND parameter based on the condition code returned by previous step.

If COND= (RC, RO) is true then the step with COND parameter execution will get bypassed.

If COND= (RC, RO) is false then the step with COND parameter will get executed.


COND ParameterContinue jobTerminate job
COND=(code,GT)Code <= RCCode > RC
COND=(code,GE)Code < RCCode >= RC
COND=(code,EQ)Code ¬= RCCode = RC
COND=(code,LT)Code >= RCCode < RC
COND=(code,LE)Code > RCCode <= RC
COND=(code,NE)Code = RCCode ¬= RC

Example:

//JOB CARD 
//S1 EXEC PGM=P1 
//S2 EXEC PGM=P2 
//S3 EXEC PGM=P3, COND=(12,NE)
//S4 EXEC PGM=P4       

S2 Return codeS3 Status
RC=12Should Execute
RC <> 12Will not Execute

JCL - CLASS JCL - DSENQSHR

Advertisements