What is Condition parameter?
As one job may have several job steps to execute. Suppose in my job there are 3 steps to execute and after execution of each step it will return a Return code (RC)/ Condition Code.
Now i am checking this Return Code in my program to execute or bypass particular step in my JOB.
This checking of Return code done by the use of COND parameter.
Real time example where COND parameter using.
Suppose my job contains two steps. In my first step i am copying a file into another file for backup purpose and in my second step i am deleting the original file which i used in step1 if step1 completed successfully else not.
So to handle such condition without error the best choice will be use COND parameter.
Where to code Condition Parameter?
The COND parameter can be coded in Job statement or to particular job step depending on requirement.
If condition parameter coded for job statement then it checks each job step Return code (RC) according to COND parameter.
If condition parameter coded for job step then it checks particular job steps return code only.
Common condition codes
Return Code Explanation
_______________________________________________________________________________________________________
0 Successful execution
4 Successful execution with some warning messages
8 Error in job step
16 Serious error
______________________________________________________________________________________________________
COND parameter on JOB statement
Syntax:
COND=(comparison code(RC value),condition)
The value of Return code is in between 00 to 4095 so comparison code must be any number among this.
This comparison code is compared with Return code of job steps and takes the decision whether to execute a step or not.
In condition parameter operator like Greater Than (GT), Less than (LT) etc. are coded.
Table for condition parameter:
Condition Explanation
GT Checks comparison code is greater than RC
GE Checks comparison code is greater than or equal to RC
LT Checks comparison code is less than RC
LE Checks comparison code is less than or equal to RC
EQ Checks comparison code equals to RC
NE Checks comparison code not equals to RC
Example for condition parameter coded on Job statement.
Here if RC of step1 is 00 so whether 8 is less than 00 ? No. then step2 will be executing. Now if RC of step2 is 16 so 8 is less than 16 then step3 will not execute and if there is step4,step5 then that will also not executing.
Can i check multiple conditions in my job statement?
Yes you can just code COND=((4,LE),(8,GT),(16,LT))
If all the above condition get satisfied then only the job step will be terminating i.e
4 is less than RC and
8 is greater than RC and
16 is less than RC.
COND parameter coded on EXEC/step name statement
This applies the COND parameter on particular step not for all job steps. The job step will be executing or bypassed depending upon depending upon RC.
Syntax:
COND=(comparison code,condition,step name)
Here step name specifies name of preceding step whose RC will be checked.
Example of COND parameter:
If RC of step1 is 00 then condition is not satisfying so step2 will be executing .
If we not mention any step name then it will check all prior step RC.
What is COND=EVEN/ONLY parameter?
COND=EVEN means a particular step has to be executed even if all previous steps terminate abnormally or completes successfully means forceful execution.
COND=ONLY means a particular step will be executing only if previous steps terminates abnormally.
Can we code EVEN and ONLY in one JOB?
You can’t as EVEN and ONLY are mutually exclusive so code any one of them in your program.
No comments:
Post a Comment