ibm question paper-jcl
TRANSCRIPT
z/OS MVS JCL Advanced
© Copyright IBM Corp., 2000, 2004. All rights reserved.
z/OS MVS JCL Advanced
Page 2 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Course Details
Audience
This course is designed for intermediate to advanced JCL system programmers, operators, and application programmers who have some knowledge of basic JCL coding.
Prerequisites
This course assumes that the student has basic knowledge of IS technologies, data processing, software, and hardware from OS/390 Introduction (38051), OS/390 MVS Concepts and Facilities (38052), z/OS MVS JCL Introduction (38053), and z/OS MVS JCL Intermediate courses.
Introduction
z/OS MVS JCL Advanced
Page 3 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Course Introduction
z/OS MVS JCL Advanced builds on topics covered in MVS JCL Introduction and Intermediate to
present the advanced uses of procedures and utilities.
The first unit, Reviewing Procedures reviews addition, override, and nullification statements that enable procedures to be modified at execution time to meet particular processing needs.
The second unit, Creating Effective Procedures, examines procedures from the perspective of the procedure creator. The emphasis is on the effective use of symbolic parameters, DDNAME operands, and other coding techniques that can relieve the procedure creator of the need for extensive JCL coding.
The third unit, Using Utility Programs, introduces utility programs and the JCL required to communicate with utilities. You will analyze condition codes and system error messages that provide clues to the cause of JCL and utility control statement errors.
The fourth unit, Sample Utility Applications, review a range of practical applications that can be achieved with utilities. The material adopts a problem-solving approach in determining the JCL and utility control statements that are required for common processing situations.
Introduction
z/OS MVS JCL Advanced
Page 4 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Course Objectives
Introduction
At the end of this course, you will be able to:
• Correctly code statements to execute procedures
• Correctly code addition, override and nullification statements to modify procedure EXEC and DD statement parameters at the time of execution
• Use standard notations to identify procedure statements in a listing of effective JCL
• Correctly code procedures using DDNAME operand and symbolic parameters
Continued…
z/OS MVS JCL Advanced
Page 5 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Course Objectives (cont’d)
Introduction
At the end of this course, you will be able to:
• Assign values to symbolic parameters and the DDNAME operand when executing a procedure
• Identify the purpose of common utility programs
• Code the JCL and utility control statements required to execute selected utilities
• Using a Utilities Manual, select and execute appropriate utilities for common processing requirements
z/OS MVS JCL Advanced
Page 6 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
UNIT Reviewing Procedures
Using Procedures
Invoking Procedures
Invoking Nested Procedures
Interpreting the Effective JCL
Topics:
z/OS MVS JCL Advanced
Page 7 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Most installations have pre-coded procedures that can help you perform frequent jobs, more easily.
This unit reviews and summarizes the concepts and skills needed to execute and modify procedures. The unit will focus on the JCL programmer as a procedure user, rather than as a procedure creator.
Unit Introduction
Unit: Reviewing Procedures
Introduction
z/OS MVS JCL Advanced
Page 8 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
At the end of this unit, you will be able to:
• Distinguish between in-stream and cataloged procedures
• Code a statement to invoke a procedure
• Code addition, override, and nullification statements to modify procedure EXEC and DD statement
• Code a statement to invoke and modify a nested procedure
• Use standard notations to identify procedure statements in a JCL listing
Unit Objectives
Unit: Reviewing Procedures
Introduction
z/OS MVS JCL Advanced
Page 9 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
UNIT Reviewing Procedures
Using Procedures
Invoking Procedures
Invoking Nested Procedures
Interpreting the Effective JCL
Topics:
z/OS MVS JCL Advanced
Page 10 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
At the end of this topic, you will be able to:
• Define a procedure
• Explain the importance of using procedures
• Distinguish between in-stream and cataloged procedures
• Identify in-stream procedures
• Explain the concepts and skills needed to execute procedures
• Code an effective JCL
Topic Objectives
Unit: Reviewing Procedures Topic: Using Procedures
Introduction
z/OS MVS JCL Advanced
Page 11 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
What are procedures?
Procedures are pre-coded sets of Job Code Language (JCL) statements with a unique name. For a procedure to perform its function the procedure in a job stream must be placed at the appropriate location.
Why use procedures?
If you perform a task regularly and the JCL used is lengthy or complex, it is to your advantage to use a procedure.
Using Procedures
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
z/OS MVS JCL Advanced
Page 12 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Procedures are categorized according to where they are located. Following are the two types of procedures:
• In-stream procedure – defined in the job stream itself.
• Cataloged procedure – stored as a member of a partitioned data set.
Types of Procedures
PROC
PEND
(In-stream)
(Cataloged)
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
z/OS MVS JCL Advanced
Page 13 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
You can identify in-stream procedures in the job
stream by:
• The PROC statement, which begins the procedure definition
• The PEND statement, which ends the procedure definition
The example on the right shows an in-stream
procedure named PROCA.
Identification of In-stream Procedures
The PROC statement serves to isolate the procedure definition from the rest of the job stream.
//PROCA PROC//PSTEP1 EXEC PGM=MYPROG//DDIN DD DSN=INDATA,// DISP=SHR//DDOUT DD SYSOUT=A // PEND
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
z/OS MVS JCL Advanced
Page 14 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
A(n) ______________ procedure is stored as a member of a partitioned data set.
Are We on Track?
Unit: Reviewing Procedures Topic: Using Procedures
Review
z/OS MVS JCL Advanced
Page 15 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Which of the following begins an in-stream procedure and isolates it from the rest of the job stream?
A. A PROC statement
B. A PEND statement
C. A procedure step
Are We on Track?
Unit: Reviewing Procedures Topic: Using Procedures
Review
z/OS MVS JCL Advanced
Page 16 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
You can execute a procedure with an EXEC statement that identifies the procedure by name:
//GO EXEC PROCAor
//GO EXEC PROC=PROCA
To invoke an in-stream procedure, use the name that is identified on the PROC statement of the procedure definition.
To execute a cataloged procedure, use the name under which the procedure is cataloged in the procedure library. An example of executing a cataloged procedure is shown on the right.
Executing a Procedure – An Example
PROC A
CATALOGED PROCEDURES
//GO EXEC PROC A
1 00 1
1 00 1
JOBJOB
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
z/OS MVS JCL Advanced
Page 17 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
When you execute a procedure, the system blends the JCL from the procedure definition into the job stream at the appropriate point.
The combination of the JCL you code and the JCL in the procedure definition is called the Effective JCL.
An example of an effective JCL is shown on the right.
Effective JCL
//MYJOB JOB 377-44-1247,D.ROSE//STEP1 EXEC PGM=PROG1//DD1 DD DSN=DATA1,DISP=SHR//DD2 DD SYSOUT=A//PSTEP1 EXEC PGM=MYPROG//DDIN DD DSN=INDATA,// DISP=SHR//DDOUT DD SYSOUT=A
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
Continued…
z/OS MVS JCL Advanced
Page 18 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Notice the relationship between the JCL you code to define PROCA and the JCL that results when you execute the procedure - in the Procedure Definition and the Statement that executes the procedure. Notice that the coded JCL is in a different sequence than the Effective JCL, in the previous slide.
Effective JCL (cont’d)
//MYJOB JOB 377-44-1247,D.ROSE//PROCA PROC//PSTEP1 EXEC PGM=MYPROG//DDIN DD DSN=INDATA,// DISP=SHR//DDOUT DD SYSOUT=A// PEND//JSTEP1 EXEC PGM=PROG1//DD1 DD DSN=DATA1,// DISP=SHR//DD2 DD SYSOUT=A//STEP2 EXEC PROCA
//MYJOB JOB 377-44-1247,D.ROSE//PROCA PROC//PSTEP1 EXEC PGM=MYPROG//DDIN DD DSN=INDATA,// DISP=SHR//DDOUT DD SYSOUT=A// PEND//JSTEP1 EXEC PGM=PROG1//DD1 DD DSN=DATA1,// DISP=SHR//DD2 DD SYSOUT=A//STEP2 EXEC PROCA
Unit: Reviewing Procedures Topic: Using Procedures
Concepts
z/OS MVS JCL Advanced
Page 19 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Complete the JCL statement to invoke a procedure named COBUCLG:
//STEP1 EXEC __________________
Are We on Track?
Unit: Reviewing Procedures Topic: Using Procedures
Review
z/OS MVS JCL Advanced
Page 20 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Match the following terms with their descriptions:
1. Procedure definition A. The JCL in a procedure definition combined with the JCL you code
2. Effective JCL B. Pre-coded JCL with a unique name, which consists of one or more job steps
3. Procedure step C. A job step within a procedure
Are We on Track?
Unit: Reviewing Procedures Topic: Using Procedures
Review
z/OS MVS JCL Advanced
Page 21 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Procedures – Pre-coded sets of JCL with a unique name.
Partitioned data set – A data set on direct access storage that is divided into partitions, called members, each of which can contain a program, part of a program, or data.
PROC statement – A statement that begins a procedure definition and isolates it from the other JCL in a job stream.
PEND statement – A statement that ends a procedure definition.
Procedure step – A job step that is part of a procedure definition.
Glossary
Unit: Reviewing Procedures Topic: Using Procedures
Glossary
z/OS MVS JCL Advanced
Page 22 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Now that you have completed this topic, you should be able to:
• Define a procedure
• Explain the importance of using procedures
• Distinguish between in-stream and cataloged procedures
• Identify in-stream procedures
• Explain the concepts and skills needed to execute procedures
• Code an effective JCL
Topic Summary
Unit: Reviewing Procedures Topic: Using Procedures
Summary
z/OS MVS JCL Advanced
Page 23 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
UNIT Reviewing Procedures
Using Procedures
Invoking Procedures
Invoking Nested Procedures
Interpreting the Effective JCL
Topics:
z/OS MVS JCL Advanced
Page 24 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
At the end of this topic, you will be able to:
• Obtain and modify a procedure listing
• Explain the rules to code changes to EXEC statement parameters
• Change DD parameters
• Explain the rules to code changes to DD parameter
• Code the DCB subparameters
• Discuss the rules for sequencing multiple override and addition DD statements
• Identify the common source for JCL errors
Topic Objectives
Unit: Reviewing Procedures Topic: Invoking Procedures
Introduction
z/OS MVS JCL Advanced
Page 25 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Before invoking a procedure for a particular job, you may want to obtain a listing of it to see if it executes the programs you need, and uses the appropriate data sets.
How to obtain a procedure listing?
To obtain a procedure listing you can:
• Use the IEBGENER Utility
• Use the IEBPTPCH Utility
• Run a job and include TYPRUN=SCAN on the JOB statement. Within the job stream, include an EXEC statement that executes the procedure:
//MYJOB JOB 12,D.ROSE,
// TYPRUN=SCAN
//JSTEP EXEC PROCB
Obtaining a Procedure Listing
JOBJOB
1 00 1
Concepts
TYPRUN=SCAN
Unit: Reviewing Procedures Topic: Invoking Procedures
z/OS MVS JCL Advanced
Page 26 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
After analyzing a procedure listing, you may find it needs some minor alterations to meet your processing needs.
For example, you may want to change the time allocated for the procedure to use the CPU, or change a data set that used in the execution of the procedure. You can temporarily alter – both procedure EXEC and DD statement operands
How to modify?
The procedure listing can be modified by coding:
•Addition statement
•Nullification statement
•Override statement
Modifying Procedure Listing
However, changes will apply to only one invocation of the procedure, without changing the procedure definition.
OVERRIDE
PROCATIME=(1,30)
TIME=(3)
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 27 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Changing EXEC Statement Parameters
You can override, nullify, or add EXEC statement parameters such as PARM or TIME on the EXEC statement to invoke the procedure.
Following are the rules for coding changes to EXEC statement parameters:
• Follow the name of the procedure with a comma.
• Give the name of the EXEC statement parameter to be overridden, nullified or added, followed by a period.
• Give the name of the procedure step, followed by an equal sign.
• Give the new value for the parameter if you are overriding or adding a value. Do not code a value if you are nullifying.
• Code changes on the EXEC statement in which you invoke the procedure.
One exception is the PGM parameter, which is the only EXEC statement parameter that cannot be overridden or nullified. The only way to execute a procedure with a different program is to assign a value to a symbolic PGM parameter.
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 28 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
The general form for coding changes to EXEC statement parameters is as follows:
• To modify EXEC statement parameters for any procedure step, append the procedure step to the parameter.
• If the stepname is omitted, the parameter applies to all steps of the procedure, with the exception of the PARM parameter.
• If the stepname is omitted when adding or overriding a PARM parameter, the PARM value only applies to the first step in the procedure.
• Any PARM parameters in subsequent steps within the procedure are nullified.
The general form for coding changes to EXEC statement parameters is shown above.
Coding Changes to EXEC Statement Parameters
Parameterto be
changedProcedure
stepNew
Value
PROCEDURENAME,PARAMETER.PROCSTEPNAME=VALUE// JSTEP EXEC
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 29 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
To illustrate an EXEC statement override, review
the procedure definition for TRANSACT, as
shown on the right.
The time allocated for TRANSACT is 1 minute 30
seconds.
If the transaction file for the week were much
larger than usual, you might want to change the time allocated for the procedure to 3 minutes. You would code the following override statement when executing TRANSACT:
//JSTEP EXEC TRANSACT,
// TIME.PSTEP1=3
Changing EXEC Statement Parameters – An Example
//PSTEP1 EXEC PGM=PROG1, // TIME=(1,30)//DD1 DD DSN=INTRAN,DISP=SHR//DD2 DD DSN=MASTER,DISP=SHR//DD3 DD SYSOUT=A//DD4 DD DSN=&&VALID,// DISP=(NEW,PASS),// UNIT=SYSDA,SPACE=(TRK,(1,1))//PSTEP2 EXEC PGM=PROG2,TIME=5//DD5 DD DSN=&&VALID,// DISP=(OLD,DELETE)//DD6 DD SYSOUT=A
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 30 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Which of the following actions can you perform when a procedure is invoked for use?
A. Override the PGM=parameter on one or more procedure EXEC statements
B. Override operands, such as ACCT, on procedure EXEC statements
C. Nullify data specifications on procedure DD statements
D. Add data specifications on procedure DD statements
E. Permanently alter the JCL in a cataloged procedure
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 31 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Complete the following JCL statement to invoke the procedure TRANSACT and pass a PARM value of '9/10/98' to PROG1 in PSTEP1:
//EXEC TRANSACT, _________________________
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 32 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Sequencing Multiple Changes
Many changes can be made to EXEC statement parameters for one or more procedure steps by combining
them on the EXEC statement you use to invoke the procedure.
What are the sequence rules for coding multiple EXEC statement changes?
To sequence multiple changes to EXEC statement parameters:
• Specify alterations in procedure step sequence. The alterations for one step must be specified before the alterations for a subsequent step.
• Within any one step, you can specify alterations in any sequence.
• Separate alterations from each other by a comma.
• Multiple changes must be coded in procedure step sequence.
Parameters with a stepname appended must appear before any parameters coded without appended stepnames.
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 33 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Assume you need to make the following alterations to EXEC statement operands in the TRANSACT procedure:
• Increase the time restriction for PSTEP1 to 3 minutes
• Revert to the installation-defined TIME default for PSTEP2
• Add a PARM parameter value of 01/29/99 for the EXEC statements in PSTEP1 and PSTEP 2
These modifications are coded on the EXEC statement that invokes the procedure, as shown on the right.
Sequencing Multiple Changes – An Example
//JSTEP EXEC TRANSACT,// TIME.PSTEP 1=3,// PARM.PSTEP1=’01/29/99’,// TIME.PSTEP2=,// PARM.PSTEP2=‘01/29/99’
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 34 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Which of the following statements could you use to invoke the TRANSACT procedure and make the following changes:
a. Revert to the installation defined CPU time for PROG2 in PSTEP2
b. Restrict the amount of time PROG1 in PSTEP1 can use the CPU to 2 minutes
c. Pass a PARM value of ‘12/1/99’ to PROG1
A. // EXEC TRANSACT,PARM.PSTEP1=‘12/1/99’,TIME.PSTEP1=2,TIME.PSTEP2=
B. // EXEC TRANSACT,TIME.STEP2=,TIME.STEP1=2,PARM.STEP.STEP=‘12/1/99’
C. // EXEC TRANSACT PARM.STEP=,TIME.STEP=
D. // EXEC TRANSACT,TIME.PSTEP1=2,PARM.PSTEP1=‘12/1/99’,TIME.PSTEP2=
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 35 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Why make the change?
For example, you may want to execute a procedure such as TRANSACT using a different storage location for the output data set.
How to make the change?
Code an override DD statement immediately following the EXEC statement that executes the procedure.
The following override statement executes the TRANSACT procedure using NEWTRAN rather than INTRAN:
//PSTEP1.DD DD DSN=NEWTRAN,
// UNIT=3390,
// VOL=SER=123435
Changing DD Parameters
INTRAN
NEWTRAN
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
VOL123435
z/OS MVS JCL Advanced
Page 36 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Rules for Coding Changes to DD Parameter
The rules for coding changes to DD statement parameters are as follows:
• Code a special DD statement immediately following the EXEC statement to invoke the procedure.
• The DD statement has a two-part name:
o The first part consists of the name of the procedure step where the DD parameter to be changed occurs or to which the DD statement is to be added, followed by a period.
o The second part of the name is the DD statement to be overridden in the procedure step or the DDNAME defined for a data set to be added.
• Specify the parameter to be changed, added, or nullified, followed by an equal sign and the value of the parameter.
If you are nullifying a parameter, do not code a value.
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 37 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
How to code a stepname?
You can code the stepname in front of the DDNAME to override or to add. Notice that this sequence is the opposite of that used when coding EXEC statement overrides or additions.
The general form for DD additions, overrides, and nullifications is shown above.
General Form for DD Changing Parameters
PARAMETER=VALUE// PROCSTEPNAME.DDNAME DD
Procedure step in which the DD
statement occurs or to which a DD statement
is to be added
Name of the DD statement to be overridden or
added
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 38 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Why is DDNAME important?
The DDNAME on the submitted statement determines whether the system treats the statement as an addition or override.
If the DDNAME on the submitted statement matches a DDNAME within the procedure, the parameters on the procedure statement are overridden, as in the example shown on the right. If not, the statement is treated as an addition statement.
If a parameter in the procedure DD statement is matched by one in a submitted DD override statement, it is overridden. Otherwise it is retained.
Significance of DDNAME
TRANSACT Procedure Definition
//PSTEP1 EXEC PGM=PROG1,// TIME=(1,30),// PARM=‘01/29/99’//DD1 DD DSN=INTRAN,// DISP=SHR
Override Statement:
//PSTEP1.DD1 DD DSN=NEWTRAN,// UNIT=3390,VOL=SER=123435
DD statements are added in their entirety. Overridden statements are modified parameter by parameter.
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 39 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
The data control block (DCB) unlike other parameters, is not overridden in its entirety, but by subparameter.
DCB subparameters must be nullified explicitly. You code the DD override statement with the parameters to be overridden in parentheses. The others are retained, as shown on the right.
Similarly DCB subparameters must be nullified explicitly. Those that are not nullified are retained. To nullify the entire DCB parameter, you must explicitly nullify each subparameter as shown below:
// DCB=(BUFNO=,BLKSIZE=,
// RECFM=,BUFL=)
DCB Subparameters
Original Parameters://DD1 DD DSN=MYDSET,DISP=SHR,// DCB=(BUFNO=1,BLKSIZE=800,// RECFM=FB,BUFL=800)
DCB Override Statement://PSTEP1.DD1 DD DCB=(BLKSIZE=320,// BUFL=320)
Resulting Parameters://DD1 DD DSN…// DCB=(BUFNO=1,BLKSIZE=320,// RECFM=FB,BUFL=320)
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 40 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
On which of the following statements do you specify changes to procedure data specifications:
A. On the PROC statement of the procedure
B. On the EXEC statement you use to invoke the procedure
C. On the special DD statements you code when invoking the procedure
D. On the PEND statement
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 41 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
Review the JCL below for a procedure named ANYPROC.
//PSTEPA EXEC PGM=PROG1
//DD1 DD DSN=DATFIL,
// DISP=SHR
//DD2 DD SYSOUT=A
//PSTEPB EXEC PGM=PROG2
//DD3 DD SYSOUT=A
1. Code the JCL needed to invoke ANYPROC
//JSTEP EXEC _________
2. Specify, for PROG2, a data set named INDATA. (PROG2 refers to the data set by the DDNAME TEST.)
//PSTEPB.TEST DD _________
z/OS MVS JCL Advanced
Page 42 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Rules for Coding Multiple Override and Addition DD Statements
When you code multiple addition and override DD statements, you must follow specific sequencing rules.
• Code override and addition DD statements in procedure step sequence.
• Within a step, specify override DD statements in the same DDNAME sequence as they appear in the procedure.
• Within a step, code addition DD statements following override DD statements.
Within a procedure step, you must code overrides before additions.
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 43 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
The example on the right shows the correct way to sequence the following additions and overrides for TRANSACT:
1. An override statement for PSTEP1.DD1 that identifies MYDATA as the input data set
2. An addition statement for PSTEP1.DD2 that identifies an input data set named CKDATA (referred to by the DDNAME DD2 in PROG1)
3. An override statement for PSTEP2.DD6 that identifies INVOICE as the newly created output data set
Sequencing Multiple Changes – An Example
//JSTEP EXEC TRANSACT
1.//PSTEP1 DD1 DD DSN=MYDATA2.//PSTEP1.DD2 DD DSN=CKDATA, // DISP=SHR3.//PSTEP2.DD6 DD DSN=INVOICE, // DISP=(NEW,CATLG), // UNIT=3390, // VOL=SER=692912, // SPACE=(TRK,10)
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 44 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Why code the ddname?
While coding multiple addition and override statements for the same procedure step, you can use a shorthand form.
How to code the ddname?
Code the ddname for the first override or addition to each procedure step.
// ddname DD …
Thus, the changes to PSTEP1 in the TRANSACT procedure in the previous example could have been coded as shown on the right.
Coding the ddname
//JSTEP EXEC TRANSACT
//PSTEP1.DD1 DD DSN=MYDATA
//DD2 DD DSN=CKDATA
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 45 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Improperly sequenced addition and override
statements are common source of JCL errors.
JCL error – An example
If an addition statement is coded before an override statement for the same procedure step, the system will interpret the override statement as another addition.
The procedure may execute, but with the wrong data as illustrated on the right.
Common Source for JCL Errors
MASTER
INTENDED OVERRIDE
WRONG DATA
INCORRECT OUTPUT
RIGHTDATA
1 00 1
1 00 1
Unit: Reviewing Procedures Topic: Invoking Procedures
Concepts
z/OS MVS JCL Advanced
Page 46 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Review the following DD statements from STEPC of a sample procedure: . . .//DD4 DD DSN=A.B.C…//DD5 DD DSN=STRP …//DD6 DD DSN=TYPE3,..//DD7 DD DSN=A.B.D…
In this exercise, code the following override DD statements using the shorthand form:
1. Code an override statement to specify a data set named TEST1 instead of A.B.C//STEPC.DD4 DD __________
2. Code an override statement to specify a data set named TESTDATA rather than STRP //DD5 DD __________
3. Code an override statement to specify a data set named TEST2 instead of A.B.D//DD7 DD __________
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 47 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Place the following override and addition DD statements in the order in which they must be specified. (Assume procedure DD statements are in alphanumeric order.)
A. An override DD statement for DD6 in PSTEP3
B. An override DD statement for DD2 in PSTEP1
C. An addition DD statement for DD3 in PSTEP1
D. An addition DD statement for DD5 in PSTEP3
E. An override DD statement for DD4 in PSTEP1
Are We on Track?
Unit: Reviewing Procedures Topic: Invoking Procedures
Review
z/OS MVS JCL Advanced
Page 48 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Glossary
IEBGENER Utility – A data set utility program that is designed to copy records from a sequential data set.
IEBPTPCH Utility – A standard IBM utility program that is designed to print or punch data sets.
TYPRUN=SCAN – A JOB statement parameter that suppresses execution of the job. It is often used for checking JCL syntax errors.
Operands – Keyword or positional statements in the operand field of a JCL statement.
Data Control Block – A parameter on a DD statement that describes the attributes of a data set, such as block size and record format.
Unit: Reviewing Procedures Topic: Invoking Procedures
Glossary
z/OS MVS JCL Advanced
Page 49 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Now that you have completed this topic, you should be able to:
• Obtain and modify a procedure listing
• Explain the rules to code changes to EXEC statement parameters
• Change DD parameters
• Explain the rules to code changes to DD parameter
• Code the DCB subparameters
• Discuss the rules for sequencing multiple override and addition DD statements
• Identify the common source for JCL errors
Topic Summary
Unit: Reviewing Procedures Topic: Invoking Procedures
Summary
z/OS MVS JCL Advanced
Page 50 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
UNIT Reviewing Procedures
Using Procedures
Invoking Procedures
Invoking Nested Procedures
Interpreting the Effective JCL
Topics:
z/OS MVS JCL Advanced
Page 51 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
At the end of this topic, you will be able to:
• Define nested procedure
• Code overrides and additions
Topic Objectives
Unit: Reviewing Procedures
Introduction
Topic: Invoking Nested Procedures
z/OS MVS JCL Advanced
Page 52 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
What is a nested procedure?
When procedures are nested, one procedure
invokes another.
Nested procedure – An example
There are three procedures:
PROCA
PROCB
PROCC
In the example on the right, there are three procedures, PROCA, PROCB, and PROCC.
PROCA invokes PROCB, and PROCB invokes
PROCC.
Nested Procedure
PROCA
//STEP1 EXEC PROCC
//STEP2 EXEC PGM=XYZ
//S1 EXEC PGM=KLM
//S2 EXEC PGM=RST
PROCC
PROCB
//PSTEP EXEC PGM=ABC
//PSTEP EXEC PROCB
Concepts
Unit: Reviewing Procedures Topic: Invoking Nested Procedures
z/OS MVS JCL Advanced
Page 53 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Procedures can be nested up to 15 levels.
Changes to nested procedures can be complex, since you can only override a procedure at the point where it is called. In the example on the right, PROCA is overridden.
Coding Overrides and Additions
//PSTEP EXEC PGM=ABC
//PSTEP EXEC PROCB
OVERRIDEOVERRIDE
//STEP1 EXEC PROCC
//STEP2 EXEC PGM=XYZ
//S1 EXEC PGM=KLM
//S2 EXEC PGM=RST
PROCA
PROCC
PROCB
Concepts
Unit: Reviewing Procedures Topic: Invoking Nested Procedures
z/OS MVS JCL Advanced
Page 54 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Assume PROCA and PROCB have the JCL shown. Note that PROCA invokes PROCB.
You want to add an addition statement with a DDNAME of DD2 to both procedures.
Coding Overrides and Additions – An Example
PROC A://PROCA PROC//PROCA1 EXEC PGM=ONE//OUT DD SYSOUT=&OUTCLASS//PROCA2 EXEC PROCB
PROC B://PROCB PROC // SET OUTCLASS=B//PROCB1 EXEC PGM=TWO//OUT DD SYSOUT=&OUTCLASS
Concepts
Unit: Reviewing Procedures Topic: Invoking Nested Procedures
Continued…
z/OS MVS JCL Advanced
Page 55 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
To include an addition statement while invoking PROCB, PROCA needs to be modified:
//PROCA PROC
//PROCA1 EXEC PGM=ONE
//OUT DD SYSOUT=&OUTCLASS
//PROCA2 EXEC PROCB
Then execute PROCA with the addition for
PROCA, as shown on the right.
Coding Overrides and Additions – An Example (cont’d)
//STEP1 EXEC PROCA//PROCA1.DD2 DD DSN=NEWDS,// DISP=SHR//PROCB1.DD2 DD DSN=NEWDS,// DISP=SHR
Unit: Reviewing Procedures
Concepts
Topic: Invoking Nested Procedures
z/OS MVS JCL Advanced
Page 56 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Assume that you have procedures named PROC1 to PROC12 (nested up to 12 levels). You execute PROC3 with an override EXEC statement as follows:
//JSTEP EXEC PROC3,TIME=3
What is the effect of this override statement?
A. The specified TIME parameter applies to PROC1 through PROC3
B. The specified TIME parameter applies to PROC3 through PROC12
C. The specified TIME parameter applies to all procedures
D. The specified TIME parameter applies to PROC3
Unit: Reviewing Procedures
Review
Topic: Invoking Nested Procedures
Are We on Track?
z/OS MVS JCL Advanced
Page 57 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Now that you have completed this topic, you should be able to:
• Define nested procedure
• Code overrides and additions
Topic Summary
Unit: Reviewing Procedures
Summary
Topic: Invoking Nested Procedures
z/OS MVS JCL Advanced
Page 58 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
UNIT Reviewing Procedures
Using Procedures
Invoking Procedures
Invoking Nested Procedures
Interpreting the Effective JCL
Topics:
z/OS MVS JCL Advanced
Page 59 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
At the end of this topic, you will be able to:
• Define effective JCL
• Explain the importance of JCL
• Obtain a JCL listing
• Distinguish the different categories of JCL statements
• Analyze the JCL listing
Topic Objectives
Unit: Reviewing Procedures
Introduction
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 60 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
What is effective JCL?
When invoking a procedure, the system executes both the JCL that you submit and the JCL that is
stored within a procedure. This is called the effective JCL.
Why is it important?
Requesting a listing of effective JCL in your job output can be helpful in tracking the source of errors, or determining if the effective JCL is what you need.
Effective JCL Listing
Unit: Reviewing Procedures
Concepts
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 61 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
How to obtain a JCL listing?
If your system does not include a JCL listing by
default, you request it by coding a value of 1 as
the first MSGLEVEL subparameter of the job
statement:
//MYJOB JOB 12,D.ROSE,
// MSGLEVEL=1
Obtaining a JCL Listing
TRANSACT
JOBJOB
1 00 1
Unit: Reviewing Procedures
Concepts
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 62 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Following is the JOB statement for LA$TEST2, which executes the TRANSACT procedure. Complete the JOB statement to ensure that the statements for TRANSACT will be listed in the job log.
//LA$TEST2 JOB 32-44,D.ROSE,___________
Are We on Track?
Unit: Reviewing Procedures
Review
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 63 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
JCL Listing
Notation in columns 1, 2 and 3
Statement identified
Cataloged procedure
In-stream procedure
// // Statements you submit with the job, including in-stream procedures definition (if applicable) and any later alteration DD statements
XX ++ A statement in a procedure definition that is used during a job execution
X/ +/ A DD statement in a procedure definition that you have overridden
XX* ++ A statement in a procedure definition, other than a comment statement, that the system considers to be a comment
*** *** A comment or job entry subsystem control statement
Unit: Reviewing Procedures
Concepts
Special notation in columns 1,2 and 3 of the JCL listing distinguish the different categories of JCL statements.These notations are listed in the table above.
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 64 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
The example on the next slide shows the JCL listing from a job called LA$TEST2, which invokes the TRANSACT procedure.
In the JCL listing, the statement numbers identify the actual sequence in which the JCL is executed.
Special notations distinguish the JCL statements submitted with the job (//) and those that are used (++).
Analyzing the JCL
Unit: Reviewing Procedures
Concepts
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 65 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
1 //LA$TEST2 JOB (31SPC090156W),ROSE,CLASS=B2 //JOBLIB DD DSN=TSOCHIS.TESTJCL.LOAD, DISP=SHR //TRANSACT PROC //PSTEP1 EXEC PGM=PROG1 //DD1 DD DSN=TSOCHIS.INTRAN,DISP=SHR //DD2 DD DSN=TSOCHIS.MASTER,DISP=SHR //DD3 DD SYSOUT=A //DD4 DD DSN=&&VALID,UNIT=SYSDA, DISP=(NEW,PASS),SPACE=(TRK,(1,1)) //PSTEP2 EXEC PGM=PROG2 //DD5 DD DSN=&&VALID,DISP=(OLD,DELETE) //DD6 DD SYSOUT=A
// PEND 3 //JSTEP EXEC TRANSACT 4 ++TRANSACT PROC 5 ++//PSTEP1 EXEC PGM=PROG1 6 ++//DD1 DD DSN=TSOCHIS INTRAN,DISP=SHR 7 ++//DD2 DD DSN=TSOCHIS.MASTER,DISP=SHR 8 ++//DD3 DD SYSOUT=A 9 ++//DD4 DD DSN=&&VALID,UNIT=SYSDA,DISP=(NEW,PASS),SPACE=(TRK,(1,1))10 ++//PSTEP2 EXEC PGM=PROG211 ++//DD5 DD DSN=&&VALID,DISP=(OLD,DELETE)12 ++//DD6 DD SYSOUT=A
Analyzing the JCL – An Example
Unit: Reviewing Procedures
Concepts
An example of effective JCL is shown above.
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 66 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
The example on the right shows the JCL listing for
a job that executes a procedure named COBUCL.
In the submitted JCL, notice the addition
statement for procedure step COB and the override statement for procedure step LKED.
Analyzing the JCL Listing
JCL Submitted:
//LA$MYJOB JOB 31SP,ROSE,// CLASS=B//JSTEP1 EXEC COBUCL//COB.SYSIN DD DSN=TEST.CNTRL//LKED.SYSLMOD DD DSN=TEST.LOAD
Unit: Reviewing Procedures
Concepts
Continued…
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 67 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Effective JCL:
1 //LA$MYJOB JOB 3ISP,ROSE,CLASS=B,2 //JSTEP1 EXEC COBUCL3 XXCOBUCL PROC4 XXCOB EXEC PGM=IKFCBL005 XXSYSPRINT DD SYSOUT=*6 XXSYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1))7 XXSYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(1,1))8 XXSYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(1,1))9 XXSYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(1,1))10 XXSYSLIN DD DSN=**LOADSET, // UNIT=SYSDA,DISP=(MOD,PASS) // SPACE=9TRK,93,300,DCB=BLKSIZE=80011//COB.SYSIN DD DSN=TESTJCL.CNTL,DISP=SHR. . .15 //LKED.SYSLMOD DD DSN=TESTJCL.LOAD, // UNIT=SYSDA,DISP=SHR X/SYSLMOD DD DSN=&&GOSET,DISP=(,PASS), // UNIT=SYSDA,SPACE=(CYL,(1,1,1,)0
The example on the right shows the JCL listing for
a job that executes a procedure named COBUCL.
In the effective JCL, the addition statement is 11,
and the override statement is number 15.
The numbers indicate the actual sequence in
which the system executes these statements.
Analyzing the JCL Listing (cont’d)
The notation (X/) marks the statement that was overridden.
Unit: Reviewing Procedures
Concepts
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 68 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
In the previous example, the notations indicate that COBUCL is a(n) __________ procedure.
Are We on Track?
Unit: Reviewing Procedures
Review
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 69 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Match the job log notation with the JCL statement it describes:
1. XX A. A DD statement in a cataloged procedure that you have overridden
2. X/ B. A DD statement in an in-stream procedure that you have overridden
3. +/ C. A statement in a cataloged procedure that is used
Are We on Track?
Unit: Reviewing Procedures
Review
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 70 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
MSGLEVEL – A JOB statement parameter that controls the printing of JCL statements and allocation messages.
Glossary
Unit: Reviewing Procedures
Glossary
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 71 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Now that you have completed this topic, you should be able to:
• Define effective JCL
• Explain the importance of JCL
• Obtain a JCL listing
• Distinguish the different categories of JCL statements
• Analyze the JCL listing
Topic Summary
Unit: Reviewing Procedures
Summary
Topic: Interpreting the Effective JCL
z/OS MVS JCL Advanced
Page 72 of 72© Copyright IBM Corp., 2000, 2004. All rights reserved.
Now that you have completed this unit, you should be able to:
• Distinguish between in-stream and cataloged procedures
• Code a statement to invoke a procedure
• Code addition, override, and nullification statements
• Modify procedure EXEC and DD statement
• Code a statement to invoke and modify a nested procedure
• Use standard notations to identify procedure statements in a JCL listing
Unit Summary
Unit: Reviewing Procedures
Summary