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:

  1. Run STEP01, and collect its return code.
  2. Run STEP02 unless the number 4 is greater than STEP01’s return code.
  3. Run STEP03 unless the number 8 is less than or equal to any previous return code.
  4. Run STEP04 only if STEP01 abnormally ended.
  5. 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

You may also like to look at:

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
CA7 – LJOB, LQ, LRLOG
CA7 – ASSIGN PF KEYS TO PERFORM YOUR COMMANDS
CA7 – LEAD TIME CONCEPT (LOOK BACK ISSUE)
CA7 Commonly used Commands
Mainframe Manuals/References/Guides/Documents Download Links
HEX Value 41 – Confused as SPACE (Hex value of 40)
EVER WONDERED WHAT DOES Z MEAN IN Z/OS
Search for a string that is in mixed case inside a PDS
S0C7 ISSUE – FIND THE INVALID (FAULT) DATA
HRECALL – MASS RECALL IN BATCH MODE
Nice Article to answer the myths on Mainframes
MAINFRAME – PS DATASET GETTING NUMBER AT END AUTOMATICALLY
MAINFRAME – GRANT and REVOKE Dataset Access
File Status Key Overview
TSO/E COMMANDS
SDSF; Status panel (ST) Columns
ABEND CODES
Glossary of z/OS terms and abbreviations
AMODE and RMODE
IMS INTERVIEW QUESTIONS
SDSF TIPS
NDM – FASTER MODE
FILEMAXX
BATCH PIPES
What is a Catalog
Conditional processing
Advertisements