JCL EXEC COND Parameter

JCL EXEC REGION JCL DD

Advertisements


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

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

Maximum 8 conditions can be coded in single COND.

If COND parameter coded at both JOB level and STEP level, step level will override the job level COND parameter.

COND coded JOB will execute when the coded COND false.

COND coded JOB execution skipped when the coded conditioned is true.

Whenever a particular step fails all the steps after the failed step will enter into flush.

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

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

Syntax:

	COND=ONLY/EVEN/(Rc,Ro)/(Rc,Ro,Stepname)

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 when the previous step execution is unsuccessful.

If the previous step execution results in abnormal then the subsequent step must get executed.

If the previous step execution results in normal then the subsequent step must get executed.


Syntax:

	COND=ONLY

Example:

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

COND=EVEN:

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

If the previous step execution results in 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

Example:

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

COND= (RC, RO):

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

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

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


Syntax:

	COND=(RC, RO )
RC:

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

The valid RC values are from 0 to 4095.

RO:

Ro is the relational operator used to validate the return code.

The valid Relational Operator is like below

Syntax:

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

COND= (RC, RO, Stepname):

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

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

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

It will be used to validate the particular step not previous step.

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

If any questions on the above, post your queries on Jcl Discussion forum


JCL EXEC REGION JCL DD

Advertisements