Saturday, 10 August 2013

JCL COND Parameter | Conditional Job Processing

JCL COND
JCL COND Parameter

JCL COND Parameter is one of the most important and vital parameters that can be used for conditional processing. Two different codes are returned in Z/OS. An application program can return code at the end of step termed as "Return Code or Completion Code". Subsequent job step can test the return code from the previous step by using the COND parameter.

The Operating system also returns a "System Completion Code" at the end of the job.
The COND parameter lets the execution of steps depend on the return code from previous steps. For example, if a compilation fails, there is no need to attempt subsequent linkage editor or execution step in the job. If the COND parameter is omitted then the system will execute all steps with a testing return code of previous steps.

Use the COND parameter to specify the return code tests the system uses to determine whether a job will continue processing. Before and after each job step is executed, the system performs the COND parameter tests against the return codes from completed job steps.

If none of these tests is satisfied, the system executes the job step; if any test is satisfied, the system bypasses all remaining job steps and terminates the job.

The tests are made against return codes from the current execution of the job. A step bypassed because of an EXEC statement COND parameter does not produce a return code.

Bypassing a step because of a return code test is not the same as abnormally terminating the step. The system abnormally terminates a step following an error so serious that it prevents successful execution. In contrast, bypassing of a step is merely its omission.

Syntax :   COND=((code,operator)[,(code,operator)]...)

Code 
Specifies a number that the system compares to the return code from each job step. the code is a decimal number from 0 through 4095
Operator
Specifies the type of comparison to be made to the return code. If the specified test is true, the system bypasses all remaining job steps. Use the chart on this page to select the correct operator. Operators and their meanings are:

Operator 
Meaning 
GT
Greater than
GE
Greater than or Equal to
EQ
Equal to
LT
Less than 
LE
Less than or Equal to
NE
Not Equal to

If you code the COND parameter on the JOB statement and on one or more of the job's EXEC statements, and if a return code test on the JOB statement is satisfied, the job terminates. In this case, the system ignores any EXEC statement COND parameters.

If the tests on the JOB statement are not satisfied, the system then performs the return code tests on the EXEC statement. If an EXEC return code test is satisfied, the step is bypassed.

 Continuation or Termination of the Job Based on the COND Parameter
 Test in the COND    
 Parameter              
 Return Code (RC) from the Just Completed Step   
 Continue Job           
 Terminate Job          
 COND=(code,GT)         
 RC >= code             
 RC < code              
 COND=(code,GE)         
 RC > code              
 RC <= code             
 COND=(code,EQ)         
 RC ¬= code             
 RC = code              
 COND=(code,LT)         
 RC <= code             
 RC > code              
 COND=(code,LE)         
 RC < code              
 RC >= code             
 COND=(code,NE)         
 RC = code              
 RC ¬= code           

Example : 1
//TYPE JOB (611,402),BOURNE,COND=(7,LT)

The COND parameter specifies that if 7 is less than the return code, the system terminates the job. Any return code less than or equal to 7 allows the job to continue.

Example : 2

//STEP010 EXEC PGM=EMP000
//STEP020 EXEC PGM=EMP001,COND=(04,LT,STEP1)

The system bypass STEP020 if 4 is less than return code of any previous step.

If you want to apply the test to the return code from a particular step within a procedure, code(number,comparision,stepname.procstep). 

In the next example, the system bypass STEP020 if 4 is less than the return code from the GO step of the EMPPROC procedure executed by step020.

Example : 3

//STEP010 EXEC EMPPROC
//STEP020 EXEC PGM=REPORT,COND=(4,LT,STEP010.GO)

Now suppose you need to override a step within the procedure to specify the COND parameter for it. Code COND.PROCSTEP=(number,Comparison).

Example: 4

//STEP020 EXEC EMPPROC,COND.GO=(4,LT)

Return Code Table .                                            

0
No error or warning detected.
4
Possible errors detected but execution should be successful.
8
Serious errors detected; execution likely to fail.
12
Serious errors detected; execution impossible.
16
Fatal error; execution cannot continue.



JCL COND PARM
Share JCL COND Parameter

Created with Artisteer

1 comment:

  1. Education without values, as useful as it is, seems rather to make man a more clever devil. See the link below for more info.

    #clever
    www.mocsbar.com

    ReplyDelete