Tags
OS expects programs to set a return code which specifies how successful the program thought it was. The most common conventional values are:
- 0 = all OK
- 4 = minor errors or problems
- 8 = significant errors or problems
- 12 = major errors or problems, the results (e.g. files or reports produced) should not be trusted.
- 16 = very serious problems, do not use the results!
OS JCL refers to the return code as COND (“condition code”), and can use it to decide whether to run subsequent steps. However, unlike most modern programming languages, conditional steps in OS JCL are not executed if the specified condition is true—thus giving rise to the mnemonic, “If it’s true, pass on through [without running the code].” To complicate matters further, the condition can only be specified after the step to which it refers. For example:
//MYJOB JOB ………..
//STEP01 EXEC PGM=PROG01
….
//STEP02 EXEC PGM=PROG02,COND=(4,GT,STEP01)
….
//STEP03 EXEC PGM=PROG03,COND=(8,LE)
….
//STEP04 EXEC PGM=PROG04,COND=(ONLY,STEP01)
….
//STEP05 EXEC PGM=PROG05,COND=(EVEN,STEP03)
….
means:
- Run STEP01, and collect its return code.
- Run STEP02 unless the number 4 is greater than STEP01’s return code.
- Run STEP03 unless the number 8 is less than or equal to any previous return code.
- Run STEP04 only if STEP01 abnormally ended.
- Run STEP05, even if STEP03 abnormally ended.
This translates to the following pseudocode:
run STEP01
if STEP01’s return code is greater than 4 then
run STEP02
end if
if any previous return code is less than or equal to 8 then
run STEP03
end if
if STEP01 abnormally ended then
run STEP04
end if
if STEP03 abnormally ended then
run STEP05
else
run STEP05
end if
If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
You may also like to look at: