Presentation is loading. Please wait.

Presentation is loading. Please wait.

Stephen Linkin Houston Community College 26-Feb-07 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM 1 How To Process Jobs Conditionally.

Similar presentations


Presentation on theme: "Stephen Linkin Houston Community College 26-Feb-07 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM 1 How To Process Jobs Conditionally."— Presentation transcript:

1

2 Stephen Linkin Houston Community College 26-Feb-07 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM 1 How To Process Jobs Conditionally

3 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.

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

5 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM4 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 CodeReasonExplanation 000Normal completion The job ended successfully. 0C11Operation exception. Can be caused by an invalid program branch or program data overwriting the instruction area of the program. 0C44Protection 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. 10Segment-translation exception. The program tried to access storage that has not been obtained. 11Page-translation exception. The program tried to access storage that was paged out. System completion codes CodeReasonExplanation 0C55 Addressing exception. The program tried to access an invalid storage address. 0C7Varies 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 CodeReasonExplanation 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.

6 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM5 COND Parameter In JOB Statement The Syntax Relational operators for the COND parameter How COND parameter handles return codes (RC) COND=((value,operator)...) OperatorMeaning GTGreater than GTGreater than GEGreater than or equal to GEGreater than or equal to LTLess than LTLess than LELess than or equal to LELess than or equal to EQEqual to EQEqual to NENot equal to NENot equal to COND ParameterContinue JobTerminate Job COND=(4,GT)RC >= 4RC = 4RC < 4 COND=(8,GE)RC > 8RC 8RC <= 8 COND=(0,LT)RC 0 COND=(8,LE)RC = 8 COND=(12,EQ)RC <> 12RC = 12 COND=(0,NE)RC = 0RC <> 0

7 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM6 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 RC Of 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))

8 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM7 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

9 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM8 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

10 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM9 Relational Expressions The Syntax keyword [operator value] OperatorMeaningOperatorMeaning NOT or ¬Logical notEQ or =Equal to GT or >Greater thanNE or ¬=Not equal to LT or =Greater than or equal to NG or ¬>Not greater LE or Not greater LE or <=Less than or than equal to NL or ¬<Not less than AND or &And OR or |Or KeywordMeaning RC RC The highest return code issued by any job step previously executed. stepname[procstep.]RC stepname[procstep.]RC The return code issued by the specified step or proc step. ABEND ABEND True if an abend has occurred. stepname.[procstep.]ABEND stepname.[procstep.]ABEND True if the specified step or proc step has abended. ¬ABEND ¬ABEND True if an abend has not occurred. stepname.[procstep.]¬ABEND stepname.[procstep.]¬ABEND True if the specified step or proc step has not abended. ABENDCC=Sxxx ABENDCC=Sxxx True if the most recent system abend code is the abend code specified. ABENDCC=Uxxxx ABENDCC=Uxxxx True if the most recent user abend code is the abend code specified. stepname.[procstep.]RUN stepname.[procstep.]RUN True if the specified step or proc step started execution. stepname.[procstep.]¬RUN stepname.[procstep.]¬RUN True if the specified step or proc step did not start execution

11 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM10 Examples Of IF/THEN Conditions The IF/THEN conditionEvaluates to true if… 1. 1. IF RC > 0 THENAny previous job step has issued a return code greater than 0. 2. 2. IF STEP1.RC = 6 THENThe return code for job step STEP1 is 6. 3. 3. 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. 4. 4. IF STEP1.ABEND THENSTEP1 ended abnormally. 5. 5. IF STEP1.¬ABEND THENSTEP1 ended normally. 6. 6. IF STEP1.ABENDCC=S0C4 THEN STEP1 ended abnormally with a system abend code of S0C4. 7. 7. IF STEP1.ORD2000A.RUN THEN The step named ORD2000A in the procedure invoked by STEP1 started execution.

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

13 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM12 End Presentation


Download ppt "Stephen Linkin Houston Community College 26-Feb-07 © 2002 - Mike Murach & Associates, 2007 - HCC, IBM 1 How To Process Jobs Conditionally."

Similar presentations


Ads by Google