Professional Documents
Culture Documents
UNIT
Introduction
Page 3 of 73
Introduction
Page 4 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 5 of 73
Introduction
Page 6 of 73
Procedure
Page 7 of 73
Identifier
Name
Operation
Parameter
Comment
In Unit 2 Coding JOB Statements you learnt that the JOB statement has a particular coding syntax. Similarly, the EXEC statement too has to be coded using a particular JCL syntax. Like the JOB statement, the EXEC statement too has five fields. The EXEC statement format includes the following: Identifier Field (//): It occupies position 1 and 2 Name Field: It names the step starting in position 3 EXEC Operator Field: It states the JCL statement type Parameter Field: It is used to state the parameters used on an EXEC statement Comment Field: This field is optional
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 8 of 73
Code a step name on all your EXEC statements even if there might not be any references to those statements.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 9 of 73
//EXAMPLE14 EXEC (More than eight characters) // RUN#2 EXEC (Does not begin in position 3)
Rest of the characters in the step name can either be alphanumeric or they can be national symbols
Special characters and spaces cannot be used in a step name
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 10 of 73
Concepts
Page 11 of 73
Which of the following step names are valid? A. $STEP#5 B. RUN TWO
C. *STEP4
D. EXAMPLE#12
Review
Page 12 of 73
Glossary
Page 13 of 73
Summary
Page 14 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 15 of 73
Introduction
Page 16 of 73
Concepts
Page 17 of 73
//JOB1
JOB
3SPO3W,CLASS=B
Program
Payroll
What does PGM= designate? PGM= designates a program the system executes during the job step. Shown here is the syntax of PGM as a positional parameter in the EXEC statement.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 18 of 73
Code the EXEC statement using the proper operator where the step name is STEP1 and the name of program is PAYROLL? //JOB1 JOB 255,SMITH
Review
Page 19 of 73
//LA$JOE JOB
//STEP1
3SPO3W,CLASS=B
EXEC PROC=MYPROC
Procedure
What does PROC= designate? PROC= designates a procedure the system executes. The syntax of PROC as a positional parameter in an EXEC statement is shown here.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 20 of 73
Concepts
Page 21 of 73
If you leave out the PGM= or PROC= keyword when coding an EXEC statement, what does the operating system do automatically? A. Search for a procedure with the specified name. B. Search for a program with the specified name. C. Search all programs and procedures with the specified name D. Display an error and cause an abnormal termination.
Review
Page 22 of 73
//LA$JOE JOB
//STEP1
3SPO3W,CLASS=B
EXEC PGR=IEFBR14
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 23 of 73
//LA$JOE JOB
//STEP1
3SPO3W,CLASS=B
SYSTEM ABEND
In the example shown here, the equal sign in the parameter field is preceded and followed by a space. The system interprets "PGM" as a procedure name and not as a keyword for the positional parameter of the EXEC statement. When this program executes, an error "NOT FOUND" may appear. You can fix this error by eliminating the spaces before and after the equal sign.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 24 of 73
Summary
Page 25 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 26 of 73
Introduction
Page 27 of 73
Concepts
Page 28 of 73
Review
Page 29 of 73
PGM=PROGA,keyword
ACCT RD DYNAMNBR ADDRSPC PERFORM REGION PARM COND TIME DPRTY CCSID
Concepts
Page 30 of 73
Summary
Page 31 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 32 of 73
Concepts
Page 33 of 73
Concepts
Page 34 of 73
Concepts
Page 35 of 73
Which EXEC statement keyword parameter passes up to 100 characters of data to a program? A. COND B. PERFORM
C. PARM
D. ACCT
Review
Page 36 of 73
//JOB1
JOB
766,SMITH
PARM=MONTHLY
PARM Parameter
REPORT
This EXEC statement passes one value (MONTHLY) as input to a program named REPORT.
Concepts
Page 37 of 73
//JOB1
JOB
766,SMITH
PARM=10-31-98
PARM Parameter
REPORT
This EXEC statement passes the date (10-31-98) as input to the program called REPORT. The subparameter is enclosed in apostrophes because special characters are used.
Concepts
Page 38 of 73
//JOB1
JOB
766,SMITH
PARM Parameter
REPORT
In this example, the EXEC statement passes both the type of report (MONTHLY) and the date (10-31-98) as subparameters of the PARM parameter. The two subparameters are enclosed in parentheses.
Concepts
Page 39 of 73
Complete the EXEC statement using the PARM parameter to pass on both the type of report (MONTHLY) and the date (10-31-98).
Review
Page 40 of 73
What are the programs to which you can give the PARM parameter to?
You can give PARM values to two programs: The Loader The module created by the Loader
The slash within the PARM parameter separates the Loader parameters from those given to the user program.
Concepts
Page 41 of 73
The ________ creates a program module in storage and passes control to it. The program then executes.
Review
Page 42 of 73
Summary
Page 43 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 44 of 73
Introduction
Page 45 of 73
Concepts
Page 46 of 73
What happens if you specify only the code and operator subparameters? If you specify only the code and operator subparameters, the test runs for all previous return codes in the job.
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 47 of 73
Concepts
Page 48 of 73
Operator GT GE EQ
NE
LT LE
Not equal to
Less than Less than or equal to
Concepts
Page 49 of 73
//JOB1
JOB
778,SMITH
PGM=DELETE PGM=UPDATE,
COND=(8,GT) DD DSN=INPUT
DELETE
In the example shown here, the COND parameter reads as follows: "If the return code from any previous step is less than 8, then bypass this step."
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 50 of 73
Code a COND parameter that skips this step if any previous step return code is less than equal to 8. //STEP2 EXEC PGM=UPDATE,
Review
Page 51 of 73
//JOB1
JOB
778,SMITH
PGM=DELETE PGM=UPDATE,
COND=(8,GT,EXAMPLE2) DD DSN=INPUT
DELETE
The COND parameter in the step EXAMPLE3, includes a stepname subparameter. This causes the COND statement to read as follows: "If the return code from step EXAMPLE2 is less than 8, then bypass step EXAMPLE3."
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 52 of 73
Concepts
Page 53 of 73
//JOB1
JOB
778,SMITH
PGM=STEP1 PGM=STEP2 PGM=STEP3 PGM=STEP4, COND=EVEN
DSN=INPUT
If you code COND=EVEN on an EXEC statement as shown here, the program STEP4 always executes, even if a previous step (e.g. STEP3) in the job terminates abnormally.
Concepts
Page 54 of 73
//JOB1
JOB
778,SMITH
PGM=STEP1 PGM=STEP2 PGM=STEP3 PGM=STEP4, COND=ONLY
DSN=INPUT
If you code COND=ONLY on an EXEC statement as shown here, the program STEP4 will execute only if a previous step in the job terminates abnormally.
Concepts
Page 55 of 73
Concepts
Page 56 of 73
Which one of the following statements would you code to run the FIXIT program in case of an abnormal termination in the previous step? A. //STEP EXEC PGM=FIXIT B. //STEP3 EXEC PGM=FIXIT,COND=EVEN C. //STEP3 EXEC PGM=FIXIT,COND=ONLY
Review
Page 57 of 73
Summary
Page 58 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 59 of 73
Introduction
Page 60 of 73
Concepts
Page 61 of 73
If the system cannot find the program, it will generate an abnormal termination (or abend) when you try to run the job.
Concepts
Page 62 of 73
//RUN31 JOB
777,CLASS=B
Error Message
Concepts
Page 63 of 73
//JOB1
JOB
776,SMITH
DSN=LIBRARY,
//JOBLIB DD //
DISP=SHR
The JOBLIB DD statement causes the system to search a private library before searching SYS1.LINKLIB.
If you want the system to call a program from a private library you should insert the JOBLIB DD statement in the job before the first EXEC statement in the job.
Concepts
Page 64 of 73
From the code determine which library the system would search first for UTILITY.
Review
Page 65 of 73
Summary
Page 66 of 73
UNIT
Topics:
The EXEC Statement The EXEC Parameter Field Additional EXEC Parameters The PARM Parameter The COND Parameter The System Library The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 67 of 73
Introduction
Page 68 of 73
The STEPLIB DD statement can be placed anywhere in a job step but it typically appears after an EXEC statement.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 69 of 73
//JOB1
//STEP1 //STEP2 //STEPLIB // //STEP3
JOB
777,SMITH
Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.
Page 70 of 73
//JOB1
In this case the STEPLIB DD statement overrides the JOBLIB statement. The system ignores JOBLIB and it does not search it in the step. It starts search only with the step library. //JOBLIB //STEP1 //STEPLIB //
JOB
DD
777,SMITH
DSN=USER1
DISP=SHR
If the system does not find the program in library specified by the STEPLIB DD statement, it searches the system libraries (SYS1LINKLIB and LINKLIST) next.
If it does not find the program there, the job step terminates abnormally.
Concepts
Page 71 of 73
Summary
Page 72 of 73
Summary
Page 73 of 73