Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Job Control Language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Conditional processing=== OS expects programs to set a return code which specifies how successful the ''program'' thought it was. The most common conventional values are:<ref name=Brown />{{rp|p.87}} *0 = Normal - all OK *4 = Warning - minor errors or problems *8 = Error - significant errors or problems *12 = Severe error - major errors or problems, the results (e.g. files or reports produced) should not be trusted. *16 = Terminal error - very serious problems, do not use the results! OS JCL refers to the return code as <code>COND</code> ("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: <syntaxhighlight lang="jcl"> //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) .... </syntaxhighlight> means: # Run <code>STEP01</code>, and collect its return code. # Don't run <code>STEP02</code> if the number 4 is greater than <code>STEP01</code>'s return code. # Don't run <code>STEP03</code> if the number 8 is less than or equal to any previous return code. # Run <code>STEP04</code> only if <code>STEP01</code> abnormally ended. # Run <code>STEP05</code>, even if <code>STEP03</code> abnormally ended. This translates to the following [[pseudocode]]: run STEP01 '''if''' STEP01's return code '''is greater than or equal to ''' 4 '''then''' run STEP02 '''end if''' '''if''' any previous return code '''is less than ''' 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''' Note that by reading the steps containing <code>COND</code> statements backwards, one can understand them fairly easily. This is an example of [[Transposition (logic)|logical transposition]]. However, IBM later introduced IF condition in JCL thereby making coding somewhat easier for programmers while retaining the <code>COND</code> parameter (to avoid making changes to the existing JCLs where {{code|COND parm}} is used). The <code>COND</code> parameter may also be specified on the <code>JOB</code> statement. If so the system "performs the same return code tests for every step in a job. If a JOB statement return code test is satisfied, the job terminates."<ref>{{cite web|last1=IBM Corporation|title=Relationship of the COND parameters on JOB and EXEC statements|url=https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.ieab500/iea3b5_Relationship_of_the_COND_parameters_on_JOB_and_EXEC_statements.htm|website=IBM Knowledge Center|access-date=Feb 21, 2018}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)