JCL EXEC COND

JCL - EXEC ADDRSPC JCL - EXEC DYNAMNBR

Advertisements


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

And also COND parameter used to specify the return code validation the system uses to determine whether a job step 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 step level and the coded condition is false, system executes the step.

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

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

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

The COND parameter cannot have a null value.


Syntax:

COND[.procstepname] = (return-code,operator)
COND[.procstepname] = ((return-code,operator[,stepname][.procstepname])
 [,(return-code,operator[,stepname][.procstepname])]... [,EVEN])
 [,ONLY]
COND=EVEN
COND=ONLY

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
[.procstepname] Procedure step-name containing ACCT to be affected

Step-name Specifies the step-name of the RC validated.


COND parameter divided into four types based on its usage.


  1. COND=ONLY
  2. COND=EVEN
  3. COND= (Rc,Ro)
  4. COND= (Rc,Ro,Stepname)

COND=ONLY:


ONLY parameter used to execute the step with COND parameter when the previous step execution is unsuccessful.

If the previous step execution result is abnormal then the subsequent step must get executed.

If the previous step execution result is normal then the subsequent step must get executed.


Syntax:

COND=ONLY

Below table representing the various possible scenarios based on the different input.


OperatorPrevious Step StatusCurrent Step Status
ONLYNot ExecutedWill execute
ONLYExecutedWill not execute

Example:

//JOB CARD 
//S1 EXEC PGM=P1 
//S2 EXEC PGM=P2 
//S3 EXEC PGM=P3, COND=ONLY 
//S4 EXEC PGM=P4 

Below table shows the possible output scenarios.


S2 StatusS3 Status
ExecutedWill not execute
Not ExecutedWill execute

COND=EVEN:


EVEN parameter used to execute step with COND parameter when the previous step execution is successful/unsuccessful.

If the previous step execution result is normal/abnormal then the current step must get executed.

COND=EVEN ignores the previous step return code and executes the current step always.


Syntax:

COND=EVEN

Below table representing the various possible scenarios based on the different input.


OperatorPrevious Step StatusCurrent Step Status
EVENNot ExecutedWill execute
EVENExecutedWill execute

Example:

//JOB CARD 
//S1 EXEC PGM=P1 
//S2 EXEC PGM=P2 
//S3 EXEC PGM=P3, COND=EVEN 
//S4 EXEC PGM=P4 

Below table shows the possible output scenarios.


S2 StatusS3 Status
ExecutedWill execute
Not ExecutedWill execute

COND= (RC, RO):


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.


Syntax:

COND[.procstepname] = (return-code,operator)

return-code/RC:

In the above syntax, Rc is the Return code of precious step.

The valid RC values are from 0 to 4095.

operator/RO:

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

Below table representing the various possible scenarios based on the different input.


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       

Below table shows the possible output scenarios.


S2 RC=12S3 Should Execute
S2 RC<> 12S3 Will not Execute

COND= (RC, RO, Stepname):


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

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

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

This COND parameter will be used to validate the particular step return code but not previous step.

Syntax:

COND[.procstepname] = (return-code,operator[,stepname][.procstepname])

return-code/RC:

In the above syntax, Rc is the Return code of precious step.

The valid RC values are from 0 to 4095.

operator/RO:

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

Below table representing the various possible scenarios based on the different input.


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

Example:

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

Below table shows the possible output scenarios.


S2 RC=12S3 Will not Execute
S2 RC<> 12S3 Should Execute

JCL - EXEC ADDRSPC JCL - EXEC DYNAMNBR

Advertisements