1 / 12

How To Process Jobs Conditionally

How To Process Jobs Conditionally. Chapter 10. Objectives. Applied objectives Code the COND parameter on a JOB or EXEC statement to conditionally execute steps based on the return codes from previous job steps.

minh
Download Presentation

How To Process Jobs Conditionally

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How To Process Jobs Conditionally Chapter 10 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  2. Objectives • Applied objectives • Code the COND parameter on a JOB or EXEC statement to conditionally execute steps based on the return codes from previous job steps. • Code IF/THEN, ELSE, and ENDIF statements to control step execution based on return codes from previous job steps. • Knowledge objectives • Identify return codes (or condition codes)and completion codes. • Identify the return code and the completion code for normal termination. • Distinguish between coding a COND parameter on a JOB statement and coding it on an EXEC statement. • In general terms, describe the differences between using the COND parameter and using the IF construct to handle conditional processing. © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  3. Return Codes • A step return code message in JCL output • Step return codes issued by OS/390 & z/OS Programs IEF142I MM01A STEP1 - STEP WAS EXECUTED - COND CODE 000 Return code Meaning 0 Program ran to successful completion. 4 Program encountered a minor error but was able to recover. 8 The program encountered a problem that inhibited successful execution. 12 The program encountered a problem that inhibited successful execution; normally, this indicates a more serious error than return code 8. 16 The program encountered a serious error and was not able to continue. © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  4. Completion Code Message • Code Message In A JCL Output Listing 19.08.15 JOB02444 IEF450I MM01B STEP1 - ABEND=S806 U0000 REASON=00000004 System completion codes Code Reason Explanation 000 Normal completion The job ended successfully. 0C1 1 Operation exception. Can be caused by an invalid program branch or program data overwriting the instruction area of the program. 0C4 4 Protection exception. The program tried to access a storage area other than its own. Often happens when a storage array is accessed with an invalid index or subscript. 10 Segment-translation exception. The program tried to access storage that has not been obtained. 11 Page-translation exception. The program tried to access storage that was paged out. System completion codes Code Reason Explanation 0C5 5 Addressing exception. The program tried to access an invalid storage address. 0C7 Varies Data exception. Caused by invalid data used in a calculation. 122 The operator cancelled the job and requested a dump. 222 The TSO/E user cancelled the job without requesting a dump. 322 The job exceeded the CPU time limit specified by the TIME parameter or the default time allowed for the job. 722 The job output limit specified by the OUTLIM, BYTES, CARDS, LINES, or PAGES parameter was exceeded. System completion codes Code Reason Explanation 804 The job’s virtual storage requirements exceeded the amount specified in the job or job step REGION parameter. 806 Program not found. The system could not find the program module to execute. 822 The region size requested is not available. Typically occurs when the REGION parameter requests a region size larger than what is currently available on the system. B37 Disk volume is full. The volume requested in the DD statement is out of space or ran out of space during execution. © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  5. COND Parameter In JOB Statement • The Syntax • Relational operators for the COND parameter • How COND parameter handles return codes (RC) COND=((value,operator)...) Operator Meaning GT Greater than GE Greater than or equal to LT Less than LE Less than or equal to EQ Equal to NE Not equal to COND Parameter Continue Job Terminate Job COND=(4,GT) RC >= 4 RC < 4 COND=(8,GE) RC > 8 RC <= 8 COND=(0,LT) RC <= 0 RC > 0 COND=(8,LE) RC < 8 RC >= 8 COND=(12,EQ) RC <> 12 RC = 12 COND=(0,NE) RC = 0 RC <> 0 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  6. COND Parameter On JOB Statements • The Job Terminates If A Job Step Has An RC Of 8 • The Job Terminates With An RC of 8 Or An RCOf 16 Or Greater • The Job Terminates With An RC Of 8, 12, Or 16 //MM01C JOB (36512),'R MENENDEZ',COND=(8,EQ) //MM01C JOB (36512),'R MENENDEZ',COND=((8,EQ),(16,LE)) //MM01C JOB (36512),'R MENENDEZ',COND=((8,EQ),(12,EQ),(16,EQ)) © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  7. The COND Parameter In An EXEC • The Syntax • The Job Step • Bypassed If Any Previous Step Has An RC Of 8 Or Greater • Bypassed If The SORT1 Job Step’s RC Is 8 • Bypassed If SORT1 Has An RC Of 8 Or VIDUPD1 Has An RC Of 13 Or Greater • Executed Even If A Previous Job Step Abended • Executed Only If A Previous Job Step Abended COND=([(value,operator[,stepname])...][ ,{EVEN} {ONLY}]) //VIDUPD1 EXEC PGM=VIDUPD1,COND=(7,LT) //VIDRPT3 EXEC PGM=VIDRPT3,COND=(8,EQ,SORT1) //VIDRPT4 EXEC PGM=VIDRPT4,COND=((8,EQ,SORT1),(12,LE,VIDUPD1)) //VIDLOG EXEC PGM=VIDLOG,COND=EVEN //VIDERR EXEC PGM=VIDERR,COND=ONLY © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  8. IF/THEN, ELSE, and ENDIF Statements • The Syntax //[name] IF (relational-expression) THEN. statements-executed-if-true.//[name] ELSE. statements-executed-if-not-true.//[name] ENDIF © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  9. Relational Expressions KeywordMeaning RCThe highest return code issued by any job step previously executed. stepname[procstep.]RCThe return code issued by the specified step or proc step. ABENDTrue if an abend has occurred. stepname.[procstep.]ABENDTrue if the specified step or proc step has abended. ¬ABENDTrue if an abend has not occurred. stepname.[procstep.]¬ABENDTrue if the specified step or proc step has not abended. ABENDCC=SxxxTrue if the most recent system abend code is the abend code specified. ABENDCC=UxxxxTrue if the most recent user abend code is the abend code specified. stepname.[procstep.]RUNTrue if the specified step or proc step started execution. stepname.[procstep.]¬RUNTrue if the specified step or proc step did not start execution • The Syntax keyword [operator value] Operator Meaning Operator Meaning NOT or ¬ Logical not EQ or = Equal to GT or > Greater than NE or ¬= Not equal to LT or < Less than GE or >= Greater than or equal to NG or ¬> Not greater LE or <= Less than or than equal to NL or ¬< Not less than AND or & And OR or | Or © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  10. Examples Of IF/THEN Conditions • The IF/THEN condition Evaluates to true if… • IF RC > 0 THEN Any previous job step has issued a return code greater than 0. • IF STEP1.RC = 6 THEN The return code for job step STEP1 is 6. • IF STEP1.RC = 6 AND STEP2.RC < 16 THEN The return code for job step STEP1 is 6 and the return code for STEP2 is less than 16. • IF STEP1.ABEND THEN STEP1 ended abnormally. • IF STEP1.¬ABEND THEN STEP1 ended normally. • IF STEP1.ABENDCC=S0C4 THEN STEP1 ended abnormally with a system abend code of S0C4. • IF STEP1.ORD2000A.RUN THEN The step named ORD2000A in the procedure invoked by STEP1 started execution. © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  11. JOB Stream Code Segment • Location (After 1st EXEC) • Required Code • Nesting • Part of a job stream // IF RC >= 8 THEN//TRERR EXEC PGM=AR5340//SYSOUT DD SYSOUT=*//ERRLOG DD DSNAME=MMA2.ERRLOG,DISP=MOD// ELSE//TRSUM EXEC PGM=AR5350//SYSOUT DD SYSOUT=*//TRANFILE DD DSNAME=MMA2.TRANFILE,DISP=SHR// ENDIF © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

  12. End Presentation © 2002 - Mike Murach & Associates, 2007 - HCC, IBM

More Related