You are on page 1of 72

z/OS MVS JCL Advanced

Copyright IBM Corp., 2000, 2004. All rights reserved.

z/OS MVS JCL Advanced

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

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 2 of 72

z/OS MVS JCL Advanced

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

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 3 of 72

z/OS MVS JCL Advanced

Course Objectives
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
Introduction
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 4 of 72

z/OS MVS JCL Advanced

Course Objectives (contd)


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

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 5 of 72

z/OS MVS JCL Advanced

UNIT

Reviewing Procedures

Topics:
Using Procedures Invoking Procedures Invoking Nested Procedures Interpreting the Effective JCL

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 6 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Unit Introduction
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.

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 7 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Unit Objectives
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

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 8 of 72

z/OS MVS JCL Advanced

UNIT

Reviewing Procedures

Topics:
Using Procedures Invoking Procedures Invoking Nested Procedures Interpreting the Effective JCL

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 9 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Objectives
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

Topic: Using Procedures

Identify in-stream procedures


Explain the concepts and skills needed to execute procedures Code an effective JCL

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 10 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Using Procedures
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.

Topic: Using Procedures

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 11 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Types of Procedures
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. PROC

Topic: Using Procedures

(In-stream)
PEND

(Cataloged)

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 12 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Using Procedures

Identification of In-stream Procedures


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

//PROCA //PSTEP1 //DDIN // //DDOUT //

PROC EXEC DD DD PEND

PGM=MYPROG DSN=INDATA, DISP=SHR SYSOUT=A

The example on the right shows an in-stream procedure named PROCA.

The PROC statement serves to isolate the procedure definition from the rest of the job stream.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 13 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Using Procedures

A(n) ______________ procedure is stored as a member of a partitioned data set.

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 14 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Using Procedures

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

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 15 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Using Procedures

Executing a Procedure An Example


You can execute a procedure with an EXEC statement that identifies the procedure by name:

//GO
or

EXEC EXEC

PROCA PROC=PROCA

//GO

JOB

PROC A

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.
//GO EXEC PROC A

CATALOGED PROCEDURES

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 16 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Effective JCL
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.

Topic: Using Procedures

//MYJOB //STEP1 //DD1 //DD2 //PSTEP1 //DDIN // //DDOUT

JOB EXEC DD DD EXEC DD DD

377-44-1247,D.ROSE PGM=PROG1 DSN=DATA1,DISP=SHR SYSOUT=A PGM=MYPROG DSN=INDATA, DISP=SHR SYSOUT=A

Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 17 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Effective JCL (contd)

Topic: Using Procedures

//MYJOB //PROCA //PSTEP1 //DDIN // //DDOUT // //JSTEP1 //DD1 // //DD2 //STEP2

JOB 377-44-1247,D.ROSE PROC EXEC PGM=MYPROG DD DSN=INDATA, DISP=SHR DD SYSOUT=A PEND EXEC PGM=PROG1 DD DSN=DATA1, DISP=SHR DD SYSOUT=A EXEC PROCA

//MYJOB //PROCA //PSTEP1 //DDIN // //DDOUT // //JSTEP1 //DD1 // //DD2 //STEP2

JOB 377-44-1247,D.ROSE PROC EXEC PGM=MYPROG DD DSN=INDATA, DISP=SHR DD SYSOUT=A PEND EXEC PGM=PROG1 DD DSN=DATA1, DISP=SHR DD SYSOUT=A EXEC PROCA

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.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 18 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Using Procedures

Complete the JCL statement to invoke a procedure named COBUCLG:

//STEP1 EXEC __________________

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 19 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Using Procedures

Match the following terms with their descriptions: 1. Procedure definition A. The JCL in a procedure definition combined with the JCL you code B. Pre-coded JCL with a unique name, which consists of one or more job steps C. A job step within a procedure

2. Effective JCL

3. Procedure step

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 20 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Using Procedures

Glossary
Procedures Partitioned data set Pre-coded sets of JCL with a unique name. 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. A statement that begins a procedure definition and isolates it from the other JCL in a job stream. A statement that ends a procedure definition. A job step that is part of a procedure definition.

PROC statement

PEND statement Procedure step

Glossary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 21 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Summary
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

Topic: Using Procedures

Identify in-stream procedures


Explain the concepts and skills needed to execute procedures Code an effective JCL

Summary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 22 of 72

z/OS MVS JCL Advanced

UNIT

Reviewing Procedures

Topics:
Using Procedures Invoking Procedures Invoking Nested Procedures Interpreting the Effective JCL

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 23 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Objectives
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: Invoking Procedures

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 24 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Obtaining a Procedure Listing
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?

Topic: Invoking Procedures

JOB
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 // //JSTEP
Concepts

JOB EXEC

12,D.ROSE, TYPRUN=SCAN PROCB

TYPRUN=SCAN

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 25 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Modifying Procedure Listing
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
However, changes will apply to only one invocation of the procedure, without changing the procedure definition.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Topic: Invoking Procedures

PROCA TIME=(1,30) OVERRIDE

TIME=(3)

Page 26 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

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.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 27 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

Coding Changes to EXEC Statement Parameters


Parameter to be changed

Procedure step

New Value

//

JSTEP

EXEC

PROCEDURENAME,PARAMETER.PROCSTEPNAME=VALUE

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.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 28 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

Changing EXEC Statement Parameters An Example


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:

//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

//JSTEP //

EXEC

TRANSACT, TIME.PSTEP1=3

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 29 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

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

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 30 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

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, _________________________

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 31 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
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.

Topic: Invoking Procedures

Parameters with a stepname appended must appear before any parameters coded without appended stepnames.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 32 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

Sequencing Multiple Changes An Example


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

//JSTEP // // // //

EXEC TRANSACT, TIME.PSTEP 1=3, PARM.PSTEP1=01/29/99, TIME.PSTEP2=, PARM.PSTEP2=01/29/99

These modifications are coded on the EXEC statement that invokes the procedure, as shown on the right.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 33 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

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=

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 34 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Changing DD Parameters
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:

Topic: Invoking Procedures

INTRAN

VOL123435

//PSTEP1.DD DD DSN=NEWTRAN, // UNIT=3390, // VOL=SER=123435


Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

NEWTRAN

Page 35 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

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


Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 36 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

General Form for DD Changing Parameters


Procedure step in Name of the DD which the DD statement to be statement occurs or to overridden or which a DD statement added is to be added

//

PROCSTEPNAME.DDNAME

DD

PARAMETER=VALUE

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.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 37 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Significance of DDNAME
Why is DDNAME important? TRANSACT Procedure Definition 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. //PSTEP1 // // //DD1 // EXEC PGM=PROG1, TIME=(1,30), PARM=01/29/99 DD DSN=INTRAN, DISP=SHR

Topic: Invoking Procedures

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.
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 38 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
DCB Subparameters
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:

Topic: Invoking Procedures

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)

// //

DCB=(BUFNO=,BLKSIZE=, RECFM=,BUFL=)

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 39 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

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

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 40 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

Review the JCL below for a procedure named ANYPROC.

//PSTEPA EXEC //DD1 // //DD2 DD //PSTEPB EXEC //DD3 DD

DD DISP=SHR SYSOUT=A SYSOUT=A

PGM=PROG1 DSN=DATFIL,

PGM=PROG2

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

_________

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 41 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

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.


Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 42 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

Sequencing Multiple Changes An Example


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

//JSTEP EXEC TRANSACT 1.//PSTEP1 DD1 DD DSN=MYDATA 2.//PSTEP1.DD2 DD DSN=CKDATA, // DISP=SHR 3.//PSTEP2.DD6 DD DSN=INVOICE, // DISP=(NEW,CATLG), // UNIT=3390, // VOL=SER=692912, // SPACE=(TRK,10)

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 43 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Coding the ddname
Why code the ddname? //JSTEP 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. EXEC TRANSACT DSN=MYDATA DSN=CKDATA

Topic: Invoking Procedures

//PSTEP1.DD1 DD //DD2 DD

// ddname DD
Thus, the changes to PSTEP1 in the TRANSACT procedure in the previous example could have been coded as shown on the right.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 44 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Procedures

Common Source for JCL Errors


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

WRONG DATA

RIGHT DATA

INCORRECT OUTPUT

INTENDED OVERRIDE

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 45 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

Review the following DD statements from STEPC of a sample procedure: . . .

//DD4 //DD5 //DD6 //DD7

DD DD DD DD

DSN=A.B.C DSN=STRP DSN=TYPE3,.. 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

__________

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 46 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Procedures

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

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 47 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Glossary
IEBGENER Utility A data set utility program that is designed to copy records from a sequential data set. A standard IBM utility program that is designed to print or punch data sets. A JOB statement parameter that suppresses execution of the job. It is often used for checking JCL syntax errors. Keyword or positional statements in the operand field of a JCL statement. A parameter on a DD statement that describes the attributes of a data set, such as block size and record format.

Topic: Invoking Procedures

IEBPTPCH Utility

TYPRUN=SCAN

Operands

Data Control Block

Glossary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 48 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Summary
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: Invoking Procedures

Summary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 49 of 72

z/OS MVS JCL Advanced

UNIT

Reviewing Procedures

Topics:
Using Procedures Invoking Procedures Invoking Nested Procedures Interpreting the Effective JCL

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 50 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Objectives
At the end of this topic, you will be able to: Define nested procedure Code overrides and additions

Topic: Invoking Nested Procedures

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 51 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Nested Procedure
What is a nested procedure? When procedures are nested, one procedure invokes another. Nested procedure An example There are three procedures: //STEP1 EXEC PROCC PROCA //PSTEP EXEC PGM=ABC

Topic: Invoking Nested Procedures

//PSTEP EXEC PROCB


PROCB

PROCA PROCB PROCC


In the example on the right, there are three procedures, PROCA, PROCB, and PROCC. PROCA invokes PROCB, and PROCB invokes PROCC.

//STEP2 EXEC PGM=XYZ PROCC //S1 EXEC PGM=KLM

//S2 EXEC PGM=RST

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 52 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Nested Procedures

Coding Overrides and Additions


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. PROCA //PSTEP EXEC PGM=ABC //PSTEP EXEC PROCB OVERRIDE PROCB

//STEP1 EXEC PROCC

//STEP2 EXEC PGM=XYZ PROCC //S1 EXEC PGM=KLM

//S2 EXEC PGM=RST

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 53 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Nested Procedures

Coding Overrides and Additions An Example


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.

PROC A: //PROCA //PROCA1 //OUT //PROCA2 PROC B: //PROCB // //PROCB1 //OUT

PROC EXEC PGM=ONE DD SYSOUT=&OUTCLASS EXEC PROCB

PROC SET OUTCLASS=B EXEC PGM=TWO DD SYSOUT=&OUTCLASS

Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 54 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Invoking Nested Procedures

Coding Overrides and Additions An Example (contd)


To include an addition statement while invoking PROCB, PROCA needs to be modified:

//PROCA //PROCA1 //OUT //PROCA2

PROC EXEC PGM=ONE DD SYSOUT=&OUTCLASS EXEC PROCB

//STEP1 //PROCA1.DD2 // //PROCB1.DD2 //

EXEC DD DD

PROCA DSN=NEWDS, DISP=SHR DSN=NEWDS, DISP=SHR

Then execute PROCA with the addition for PROCA, as shown on the right.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 55 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Invoking Nested Procedures

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

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 56 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Summary
Now that you have completed this topic, you should be able to: Define nested procedure Code overrides and additions

Topic: Invoking Nested Procedures

Summary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 57 of 72

z/OS MVS JCL Advanced

UNIT

Reviewing Procedures

Topics:
Using Procedures Invoking Procedures Invoking Nested Procedures Interpreting the Effective JCL

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 58 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Objectives
At the end of this topic, you will be able to: Define effective JCL Explain the importance of JCL Obtain a JCL listing

Topic: Interpreting the Effective JCL

Distinguish the different categories of JCL statements

Analyze the JCL listing

Introduction

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 59 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Effective JCL Listing
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.

Topic: Interpreting the Effective JCL

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 60 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Obtaining a JCL Listing
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:

Topic: Interpreting the Effective JCL

JOB

//MYJOB //

JOB

12,D.ROSE, MSGLEVEL=1
TRANSACT

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 61 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Interpreting the Effective JCL

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,___________

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 62 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
JCL Listing
Notation in columns 1, 2 and 3 Cataloged procedure // In-stream procedure // Statements you submit with the job, including in-stream procedures definition (if applicable) and any later alteration DD statements A statement in a procedure definition that is used during a job execution A DD statement in a procedure definition that you have overridden 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 Statement identified

Topic: Interpreting the Effective JCL

XX X/ XX*

++ +/ ++

***

***

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.

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 63 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Analyzing the JCL
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 (++).

Topic: Interpreting the Effective JCL

Concepts

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 64 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Interpreting the Effective JCL

Analyzing the JCL An Example


1 2 //LA$TEST2 //JOBLIB //TRANSACT //PSTEP1 //DD1 //DD2 //DD3 //DD4 //PSTEP2 //DD5 //DD6 // 3 //JSTEP 4 ++TRANSACT 5 ++//PSTEP1 6 ++//DD1 7 ++//DD2 8 ++//DD3 9 ++//DD4 10 ++//PSTEP2 11 ++//DD5 12 ++//DD6 JOB DD PROC EXEC DD DD DD DD EXEC DD DD PEND EXEC PROC EXEC DD DD DD DD EXEC DD DD (31SPC090156W),ROSE,CLASS=B DSN=TSOCHIS.TESTJCL.LOAD, DISP=SHR PGM=PROG1 DSN=TSOCHIS.INTRAN,DISP=SHR DSN=TSOCHIS.MASTER,DISP=SHR SYSOUT=A DSN=&&VALID,UNIT=SYSDA, DISP=(NEW,PASS),SPACE=(TRK,(1,1)) PGM=PROG2 DSN=&&VALID,DISP=(OLD,DELETE) SYSOUT=A TRANSACT PGM=PROG1 DSN=TSOCHIS INTRAN,DISP=SHR DSN=TSOCHIS.MASTER,DISP=SHR SYSOUT=A DSN=&&VALID,UNIT=SYSDA,DISP=(NEW,PASS),SPACE=(TRK,(1,1)) PGM=PROG2 DSN=&&VALID,DISP=(OLD,DELETE) SYSOUT=A

An example of effective JCL is shown above.


Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 65 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Analyzing the JCL Listing
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.

Topic: Interpreting the Effective JCL

JCL Submitted: //LA$MYJOB // //JSTEP1 //COB.SYSIN //LKED.SYSLMOD JOB 31SP,ROSE, CLASS=B EXEC COBUCL DD DSN=TEST.CNTRL DD DSN=TEST.LOAD

Continued
Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 66 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures Topic: Interpreting the Effective JCL

Analyzing the JCL Listing (contd)


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.

Effective JCL:
1 //LA$MYJOB JOB 3ISP,ROSE,CLASS=B, 2 //JSTEP1 EXEC COBUCL 3 XXCOBUCL PROC 4 XXCOB EXEC PGM=IKFCBL00 5 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=800 11//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 notation (X/) marks the statement that was overridden.


Concepts
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 67 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Interpreting the Effective JCL

In the previous example, the notations indicate that COBUCL is a(n) __________ procedure.

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 68 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Are We on Track?

Topic: Interpreting the Effective JCL

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 B. A DD statement in an in-stream procedure that you have overridden C. A statement in a cataloged procedure that is used

2. X/

3. +/

Review

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 69 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Glossary
MSGLEVEL A JOB statement parameter that controls the printing of JCL statements and allocation messages.

Topic: Interpreting the Effective JCL

Glossary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 70 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Topic Summary
Now that you have completed this topic, you should be able to: Define effective JCL Explain the importance of JCL Obtain a JCL listing

Topic: Interpreting the Effective JCL

Distinguish the different categories of JCL statements

Analyze the JCL listing

Summary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 71 of 72

z/OS MVS JCL Advanced


Unit: Reviewing Procedures
Unit Summary
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

Summary

Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 72 of 72

You might also like