Z/OS MVS JCL Introduction © Copyright IBM Corp., 2000, 2004. All rights reserved.

133
z/OS MVS JCL Introduction © Copyright IBM Corp., 2000, 2004. All rights reserved.

Transcript of Z/OS MVS JCL Introduction © Copyright IBM Corp., 2000, 2004. All rights reserved.

z/OS MVS JCL Introduction

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

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 2 of 107

UNIT Coding JOB Statements

The JOB Statement

The JOB Name

The JOB Parameter Field

Keyword Parameters

Complete JOB Statement

JOB Statement Parameters

Topics:

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 3 of 107

Job Control Language

What is JCL?

Job Control Language (JCL) is a control language used to identify a job to an operating system and to

describe the job’s requirements. It consists of a series of statements, each of which provides specific

instructions or information for batch processing jobs.

JCL is used to describe the work you want a system using multiple virtual storage (MVS) to perform.

The three main types of JCL statements are:

• JOB - It marks the beginning of a job and identifies the job name

• EXEC - It marks the beginning of a job step and specifies the name of the program to be executed

• DD - It describes data sets to be used within individual steps

Unit: Introduction to JCL Topic: Introduction

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 4 of 107

At the end of this unit, you will be able to:

• Explain the purpose and syntax of the JOB statement

• Define the JOB name

• Code positional parameters and keyword parameters

• Code the most commonly used keyword parameters on a JOB statement

• Complete the JOB statement

• Code additional JOB statement parameters

Unit Objectives

Unit: Coding JOB Statements

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 5 of 107

A JOB statement is the first statement in any JCL

code.

It marks the start of a job and gives the name of

the job.

The parameters included in the JOB statement,

such as accounting information and condition

settings for job termination, apply to the entire job.

Defining a JOB Statement

Unit: Coding JOB Statements Topic: The JOB Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 6 of 107

The JOB name is a 1 to 8 character name that

identifies the job so that other JCL statements or

the operating system can refer to it.

The JOB name must begin in position 3 with no

spaces between it and the identifier.

The JOB Name

//JOB1 JOB 776,M.FLURY

JOB Name

Unit: Coding JOB Statements Topic: The JOB Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 7 of 107

The operation field follows the job name. For a

JOB statement, the operator in the operation field

is JOB.

The Operation Field

//JOB1 JOB 776,M.FLURY

Operation Field

Always separate the operation field and the job name by at least one space.

Unit: Coding JOB Statements Topic: The JOB Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 8 of 107

The parameter field, in the JOB statement defines

information that applies to the entire job. This

information includes accounting information,

programmer name, and additional information

regarding the job.

One or more spaces separate the job parameters

from the JOB operation field.

The parameter field can specify job accounting

information and the programmer's name as has

been shown on the right.

A comma separates the job accounting

information and the programmer's name.

Parameter Fields

Always use a comma to separate parameters in a JOB statement.

//JOB1 JOB 504,SMITH

Parameter Field

Unit: Coding JOb Statements Topic: The JOB Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 9 of 107

The rules for coding job names have been

discussed in Unit 1, Topic 1 – JCL Statement

Syntax.

To summarize once again, these rules require a

job name to begin in position 3 and to be 1 to 8

characters in length.

The first character of a job name should

be either alphabetic or a national symbol. It

should not be a number.

The rest of the characters in the job name can be

either alphanumeric or they can be national

symbols.

Special characters or spaces are not

allowed.

Rules for Job Names: A Summary

//JOB1 JOB

//EXAMPLE4 JOB

//RUN#2 JOB

//JOB1+ JOB

//EXAMPLE14 JOB

// RUN#2 JOB

Valid Job Names

Invalid Job Names

(Includes a special character)

(More than eight characters)

(Does not begin in position 3)

Unit: Coding JOB Statements Topic: The JOB Name

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 10 of 107

The parameter field of a JOB statement appears

after the JOB operator field.

There are two types of parameters:

• Positional parameters

• Keyword parameters

What are positional parameters?

Positional parameters are parameters that are

characterized by their location in the parameter

field in relation to other parameters.

Positional parameters appear first in the

parameter field in a fixed order if there are

multiple parameters.

Positional Parameters

//JOB1 JOB 776,K.YALE

//JOB2 JOB CLASS=APositional

Parameters

Keyword Parameter

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 11 of 107

The two positional parameters for a JOB

statement are:

• Job accounting information

• Programmer name

Always code these parameters in the order shown

here and separate them by a comma.

For example: The job statement shown here

uses a job accounting number of 776 and

identifies the programmer of this job as K.YALE.

Coding the Positional Parameter

//JOBNUM1 JOB 776,K.YALE

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 12 of 107

When job accounting information consists of multiple subparameters, the job accounting subparameters must be enclosed in either parenthesis or apostrophes.

The job accounting information appear inparentheses here.

Why?

It appears in parentheses because it consists oftwo subparameters:

• 255• DEPT/OPS

The parentheses indicate to the operating system that both subparameters comprise the job accounting information.

Job Accounting Information: Subparameters

Continued…

//JOB1 JOB (255,’DEPT/OPS’),K.YALE

Multiple Parameters

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 13 of 107

Can you use special characters in

subparameters?

Special characters can be used in subparameters,

provided the subparameters are enclosed in

apostrophes.

For example: The subparameter ‘DEPT/OPS’

shown is enclosed in apostrophes because the

slash (/) is a special character.

Job Accounting Information: Subparameters (cont’d)

//JOB1 JOB(255,’DEPT/OPS’),K.YALE

Special Character

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 14 of 107

Job accounting information is the first positional

parameter you can code on a JOB statement.

If you omit the job accounting parameter, you

must indicate its absence with a comma if you are

coding the programmer name.

If you decide to leave out both positional

parameters, you do not have to include commas.

For example: In the first JOB statement here, a

comma replaces the job accounting information.

The second JOB statement includes a job

account number. Both JOB statements are valid.

Omitting Job Accounting Parameter

//JOB1 JOB ,K.YALE

//JOB2 JOB 766,K.YALE

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 15 of 107

The programmer name parameter identifies the

person or group responsible for a job.

If you decide to include this information, the

programmer name must immediately follow the

job accounting information parameter (or a

comma to indicate its absence).

The Programmer Name

//JOB1 JOB 255,’JOHN SMITH’

//JOB2 JOB ,YALE

Programmer Name

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 16 of 107

The rules that apply to a programmer's name are

as follows:

• Separate the programmer's name from a preceding or following parameter by a comma

• Make sure the programmer's name does not exceed 20 characters

• Enclose the programmer's name in apostrophes when, the name contains special characters (other than periods or hyphens)

• Double any apostrophes in the programmer's name

Coding Programmer Name

255,SMITH,MSGLEVEL=(1,0)

255,LONGPROGRAMERNAME

255,’JOHN SMITH’

255,’O”HARA’

Programmer Name Rules

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 17 of 107

If you want to code the programmer name JOHN

SMITH in a JOB statement, you would do it as

shown here.

The name is enclosed in apostrophes because

the name JOHN SMITH contains a space

between the first name and the last name (a

space is considered a special character).

Coding Programmer Name – Example 1

//JOB1 JOB 766,’JOHN SMITH’

Special Character

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 18 of 107

If the programmer name already contains an

apostrophe, you must still use apostrophes, since

the apostrophe in the programmer name is a

special character.

If you want to code the programmer name

O'HARA in a JOB statement, you would do it as

shown here.

If you prefer to enclose the programmer name in

apostrophes (for consistency), you may do so

even if the name does not contain any special

characters.

Coding Programmer Name – Example 2

//JOB1 JOB 766,’O”HARA’

Name contains an apostrophe

You must use a quotation mark to represent a single apostrophe. MVS interprets the quotation mark as an apostrophe, not as a syntactic apostrophe delimiting a string.

Unit: Coding JOB Statements Topic: The JOB Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 19 of 107

Apart from positional parameters, the parameter

may also contain keyword parameters.

What are keyword parameters?

Keyword parameters are parameters consisting of

a keyword and equal sign and variable

information.

Keyword parameters supply information to the

operating system for control of jobs.

The commonly used keyword parameters are:

• MSGLEVEL

• MSGCLASS

Defining Keyword Parameters

Continued…

Keyword Parameters

ADDRSPC

CLASS

COND

GROUP

MSGCLASS

MSGLEVEL

CARDS

NOTIFY

PASSWORD

PERFORM

PRTY

CCSID

REGION

RD

LINES

RESTART

SECLABEL

TIME

TYPRUN

USER

BYTES

PAGES

SCHENV

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 20 of 107

The characteristics of keyword parameters

include :

• They must follow any positional parameter

• They can be coded in any order

• They must include a keyword, an equal sign (=), and a value (for example, CLASS=A)

Defining Keyword Parameters (cont’d)

//JOB1 JOB 255,SMITH,CLASS=A

Keyword

Parameter

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 21 of 107

The MSGLEVEL Parameter

The MSGLEVEL parameter controls how the JCL, allocation messages, and termination messages are

printed in the job's output listing (SYSOUT).

You can request the following outputs using the MSGLEVEL parameter:

• A listing of the JOB statement only

• A listing of all user-supplied job control statements

• A listing of all user-supplied job control statements plus all inserted statements for procedures invoked by any of the job steps

• Allocation, disposition, and termination messages

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 22 of 107

The MSGLEVEL parameter includes two

subparameters:

• Statements

• Messages

The syntax for coding the MSGLEVEL parameter

is:

MSGLEVEL=(statements,messages)

Multiple subparameters are enclosed in

parentheses as has been shown here.

Coding the MSGLEVEL Parameter

//JOB1 JOB 255,SMITH,MSGLEVEL=(0,0)

Statement

Message

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 23 of 107

The MSGLEVEL Parameter – Statement Subparameter

What does the statement subparameter indicate?

The statement subparameter indicates which job control statements the system is to print on the job log.

A statement subparameter can have one of the three values:

• 0 – Print only the JOB statement

• 1 – Print all JCL statements and JES2 or JES3 control statements, including invoked procedure statements

• 2 – Print only JCL statements and JES2 and JES3 control statements from the job stream

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 24 of 107

The MSGLEVEL Parameter – Messages Subparameter

What does the messages subparameter indicate?

The messages subparameter indicates which messages the system is to print on the job log.

A messages subparameter can have one of the three values:

• 0 – Print only JCL messages. Print JES and operator messages only if the job terminates abnormally

• 1 – Print all allocation/termination messages

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 25 of 107

You can use the MSGCLASS keyword parameter

to assign an output class for your output listing

(SYSOUT). Output classes are defined by the

installation to designate unit record devices, such

as printers.

Each class is one character long and is

designated by:

• A letter (A-Z)

or

• A numeral (0-9)

For example: In order to assign class A as the

output class for your listing, you would code the

MSGCLASS parameter as shown here.

The MSGCLASS Parameter

//JOB1 JOB 255,MSGLEVEL=(1,1),

// MSGCLASS=A

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 26 of 107

Both the MSGLEVEL and MSGCLASS

parameters may have default settings, depending

on your installation. Omitting one or both of the

keyword parameters from the JOB statement,

would make the operating system use these

default settings.

In this case, you would code these parameters

only if you want to have a different message level

or message class than the preset.

Defaults for MSGLEVEL & MSGCLASS

The MSGLEVEL subparameters are universal but output class assignments and the default settings for both parameters depend on your installation.

//JOB1 JOB 255,MSGCLASS=A

//JOB2 JOB 255,MSGLEVEL=(1,1)

Default: MSGLEVEL=(1,1)

Default: MSGCLASS=A

Unit: Coding JOB Statements Topic: Keyword Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 27 of 107

At the end of this topic, you will be able to:

• Identify some additional keyword parameters and explain their purpose

• Code the additional parameters

Topic Objectives

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 28 of 107

There are a host of other keyword parameters

which you can use in your JOB statement.

You can use them to produce the exact results

you want.

Some of the most commonly used keyword

parameters have been shown here. These

parameters follow the same guidelines as the

keyword parameters MSGLEVEL and

MSGCLASS.

Keyword Parameters on JOB Statement

//JOB1 JOB keyword

COND

ADDRSPC

CLASS

NOTIFY

PRTY

REGION

TIME

TYPRUN

USER

PASSWORD

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 29 of 107

A JCL programmer can specify many ways of how

the COND parameter tests a return code. The

operator subparameter specifies the

comparison method.

Each test in a COND subparameter specifies its

own operator subparameter which is independent

of operators in any other tests.

The JCL programmer decides which operator

subparameter(s) to use.

Shown here are the various operators available.

The Operator Subparameter

GT

GE

EQ

NE

LT

LE

Operator Meaning

Greater than

Greater than or equal to

Equal to

Not equal to

Less than

Less than or equal to

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 30 of 107Concepts

This example helps you read the COND parameter in the JOB statement in the JOB statement as: "If 12 is

less than the return code, do not execute any more job steps."

The job executes the remaining job steps only if the return code is 1 through 12. If the return code is 13 or

higher, the remaining steps will be bypassed.

Reading the COND Parameter: Example 1

//JOB1 JOB 776,SMITH,COND=(12,LT)

//STEP1 EXEC PGM=PROGRAMA

//STEP2 EXEC PGM=PROGRAMB

COND=(12,LT)

Step1

Retur

n Cod

e

Step2

Return Code < 12

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 31 of 107Concepts

This example helps you to read the COND parameter in the JOB statement as: "If 12 is greater than the return

code of any job step, do not execute any more job steps."

The job executes the remaining job steps only if the return code is 12 or greater. If the return code is 0 through

11, the remaining steps will be bypassed.

Reading the COND Parameter: Example 2

COND=(12,GT)

Step1 Step2

Return Code > 12

//JOB2 JOB 776,SMITH,COND=(12,GT)

//STEP1 EXEC PGM=PROGRAMA

//STEP2 EXEC PGM=PROGRAMB

Retur

n Cod

e

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 32 of 107Concepts

This example helps you to make multiple comparisons, which might be needed in some cases. Here you can

read the COND parameters in the JOB statement as: "If 16 is less than the return code or if 8 is greater than

the return code, do not execute any more job steps.“ The job executes subsequent job steps only if the return

code is 8, 9, 10, 12, 13, 14, 15, or 16 for each previous job step.

Reading the COND Parameter: Example 3

COND=((16,LT),

(8,GT))

Step1 Step2

8 < Return Code < 16

//JOB3 JOB 776,SMITH,

// COND=((16,LT),(8,GT))

//STEP1 EXEC PGM=PROGRAMA

//STEP2 EXEC PGM=PROGRAMB

Retur

n Cod

e

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 33 of 107Concepts

You can include the COND parameter in either the EXEC statements or the JOB statements. COND

parameters coded in the JOB statement are tested before any COND parameters coded in EXEC statements

within the job. When coded in the EXEC statement, it is possible to test the return code of specific steps. In

the JOB statement, tests apply to all steps in the JOB.

COND Parameter on EXEC and JOB Statements

COND=(12,GT)

Step1 Step2

Return Code > 12

Retur

n Cod

e

//JOB3 JOB 776,SMITH,

//STEP1 EXEC PGM=PROGRAMA,

// COND=(12,GT)

//DD DD DSN=INPUT

//STEP2 EXEC PGM=PROGRAMB

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 34 of 107

Jobs are site-specific. You can check with your

operations department about the job classes that

are available for your use.

A good balance of job class assignments helps to

make the most efficient use possible of the

system.

The CLASS Parameter

//JOB1 JOB 504,SMITH,CLASS=A

Job class

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 35 of 107

The NOTIFY parameter indicates the TSO/E user the system must notify upon job completion. If you use the

NOTIFY parameter to specify your TSO/E user ID, the operating system automatically sends you a job

completion message when your job ends.

For example, to have the system send a message to JSMITH when the job EX completes, you would code

the NOTIFY parameter on a JOB statement as:

//EX JOB ...,NOTIFY=JSMITH

The NOTIFY Parameter

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 36 of 107

The PRTY parameter specifies a job's priority for

selection within its job class. Usually, this

parameter is meant to designate one job for

execution over others in a class.

The range of PRTY values is usually 0 through 15

for JES2 and 0 through 14 for JES3, with 0 having

the lowest priority.

When no priority has been specified, the system

processes jobs within the same class in a first-in,

first-out manner.

For example: If you have to give a specific priority

of 3 to a job (within its default class), you will code

the PRTY parameter on a JOB statement as has

been shown here.

The PRTY Parameter

//JOB1 JOB 504,SMITH,PRTY=3

PRTY Parameter

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 37 of 107

If you have to give a specific priority to a job within

a specific class, you will code both the CLASS

and the PRTY parameters on the JOB statement.

For example: The JOB statement shown here

specifies that the job has to run in class T and it

has been accorded a priority of 3.

It is not significant in which order the CLASS and

PRTY keyword parameters appear.

Coding CLASS and PRTY Parameters

//JOB1 JOB 504,SMITH,CLASS=T,// PRTY=3

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 38 of 107

The REGION parameter specifies the amount of

storage space (in kilobytes or megabytes) that

has to be allocated to a particular job.

You can make use of this parameter to override

the default region size set at your installation.

Incase of a JOB statement, the region specified in

the REGION parameter applies to all steps in a

job and it overrides any REGION parameter

coded on an EXEC statement.

//EXEC JOB...,REGION=valueK

//EXEC JOB...,REGION=valueM

The REGION Parameter

Continued…

Kilobytes Megabytes

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 39 of 107

Normally, when the REGION parameter makes a

GETMAIN request or a dynamic request for more

storage, it limits the amount of virtual storage

available to a program.

Different programs operate best at different region

levels. Fir instance, in order to limit the virtual

storage space of a job to 512 KB, you will need to

code the REGION parameter on the JOB

statement as:

//EX JOB ...,REGION=512K

In a similar manner, in order to limit a job's virtual

storage space to 1024 KB bytes or 1MB, you will

need to code the REGION parameter as:

//EX JOB ...,REGION=1M

The REGION Parameter (cont’d)

REGION=512K REGION=1M

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 40 of 107

When you use the REGION parameter in

conjunction with ADDRSPC=REAL, REGION

specifies the amount of real storage.

For instance, to limit a job's real storage space to

512 KB, you code the REGION parameter, along

with the ADDRSPC parameter on the JOB

statement as:

//EX JOB...,REGION=512K,

// ADDRSPC=REAL

REGION and ADDRSPC Parameters

REGION=512K REGION=1MADDRSPC=REAL

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 41 of 107

The TIME parameter specifies a maximum amount of processor time available for the job. If the limit in the

TIME parameter is reached, the job will terminate abnormally.

The syntax for the TIME parameter is:

//jobname JOB ...,TIME=(minutes,seconds)

The TIME parameter preserves processor time in case of an undetected error (like an endless loop) that may

surface only during execution of program.

For example, to limit the CPU execution time to 2 minutes and 45 seconds, you will need to code the TIME

parameter on a JOB statement as:

//EXAMPLE1 JOB 776,STUDENT,TIME=(2,45)

The TIME Parameter

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 42 of 107

The USER Parameter

The USER parameter identifies the user ID of the person who submitted the job.

This parameter uses a USERID subparameter which must be 1 to 7 alphanumeric characters or national

symbols. The first character cannot be numeric.

Many system facilities, including the Resource Access Control Facility (RACF) and the System Resource

Manager (SRM) use the USERID subparameter.

For example, in order to specify a user ID named HARRIS, you will have to code the USER parameter as:

//EXAMPLE JOB 776,STUDENT,USER=HARRIS

Whether the USER parameter is required by you or not, depends on the requirements of your site.

In most cases, the USER parameter is used in conjunction with the PASSWORD parameter.

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 43 of 107

You can code multiple keyword parameters on a

single JOB statement in any order that you

choose after any positional parameters are coded.

Here, the JOB1 job is limited in processing

time to 2 minutes, 45 seconds, and has been

allocated a limited space of 768 KB.

This job has a class of T, and a job priority of 3

within class T. This means that this job named

JOB1 will run ahead of all other jobs in

class T that have a lower priority value (PRTY

value) than 3.

The operating system notifies user JSMITH, upon

the complete execution of the job.

Coding Multiple Keyword Parameters

//JOB1 JOB 504,SMITH,// TIME=(2,45),// REGION=768K,CLASS=T,// PRTY=3,// NOTIFY=JSMITH

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 44 of 107

Virtual Storage – Storage space that may be regarded as addressable main storage by the user of a computer system in which virtual addresses are mapped into real addresses.

TSO/E – Time Sharing Option Extensions. In the MVS/ESA environment, TSO/E provides virtual storage constraint relief.

RACF – Resource Access Control Facility. An IBM licensed program that provides for access control by identifying and verifying the users of the system, by authorizing

access to protected resources, by logging the detected unauthorized attempts to enter the system, and by logging the detected accesses to protected resources.

Glossary

Unit: Coding JOB Statements Topic: JOB Statement Parameters

Glossary

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 45 of 107

UNIT Coding EXEC Statements

The EXEC Statement

The EXEC Parameter Field

Additional EXEC Parameters

The PARM Parameter

The COND Parameter

The System Library

The STEPLIB DD Statement

Topics:

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 46 of 107

At the end of this unit, you will be able to:

• Code an EXEC statement to specify a program to be executed

• Correct coding errors in an EXEC statement

• Identify which JCL statement has caused a “PROGRAM NOT FOUND” error message

• Identify the system library from which programs are retrieved at execution time

• Identify the DD statement names used to specify a private library from which programs are retrieved at execution time

• Select the place in the job stream where STEPLIB and JOBLIB DD statements should be located

• Code a JOBLIB DD statement

Unit Objectives

Unit: Coding EXEC Statements

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 47 of 107

To execute each program in a job, you need to

code one EXEC statement. Each job step begins

with an EXEC statement that identifies a program

name.

The EXEC statement is used to invoke the

program that you want to execute as part of a job.

In addition to this, you can also use the EXEC

statement to invoke a cataloged procedure.

What is a cataloged procedure?

A cataloged procedure refers to a set of JCL

statements that are stored in a library and

retrieved by its name.

A procedure may contain one or more EXEC

statements.

The EXEC Statement

Procedure

Unit: Coding EXEC Statements Topic: The EXEC Statement

Concepts

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 48 of 107

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

The EXEC Statement (cont’d)

Identifier Name Operation Parameter Comment

Unit: Coding EXEC Statements Topic: The EXEC Statement

Concepts

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 49 of 107

Shown here is an example where the step name

is STEP1. The operator is EXEC and the

positional parameter is defined by

PGM=IEBUPDTE.

What is IEBUPDTE?

IEBUPDTE is a system utility program that the

system invokes during the execution of STEP1.

The step name STEP1 identifies the EXEC

statement so that the subsequent JCL statements

can refer to it.

The EXEC Statement (cont’d)

Code a step name on all your EXEC statements even if there might not be any references to those statements.

//STEP1 EXEC PGM=IEBUPDTE

Step Name

Operator

Positional Parameter

Unit: Coding EXEC Statements Topic: The EXEC Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 50 of 107

It is important for you to always follow the JCL step name coding rules while naming a step. Not doing so will lead to JCL errors.

Following are the coding rules for the step name:

• The step name must begin in position 3

• The step name must be 1 to 8 characters in length

• The first character in the step name should be either alphabetic or a national symbol

• The first character cannot be a number

• 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

The Step Name

//STEP1 EXEC

//EXAMPLE4 EXEC

//RUN#2 EXEC

//STEP1+ EXEC

//EXAMPLE14 EXEC

// RUN#2 EXEC

Valid Step Names

Invalid Step Names

(Includes a special character)

(More than eight characters)

(Does not begin in position 3)

Unit: Coding EXEC Statements Topic: The EXEC Statement

Concepts

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 51 of 107

Shown here are two step names STEP#FOUR

and LA$JOE.

Are both the names valid step names?

The step name LA$JOE is acceptable because it

fits all the requirements defined in the rules for

coding a step name( the $ is one of the national

symbols).

However, STEP#FOUR is not a valid step name

because it contains more than eight characters.

The Step Name (cont’d)

//STEP#FOUR EXEC PGM=IEFBR14

//LA$JOE EXEC PGM=IEGENER

Unit: Coding EXEC Statements Topic: The EXEC Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 52 of 107

Procedure – Prepared sets of job control statements cataloged in a procedure library

Glossary

Unit: Coding EXEC Statements Topic: The EXEC Statement

Glossary

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 53 of 107

The parameter field follows the EXEC operator

and may contain multiple parameters. The first

parameter in an EXEC statement is a positional

parameter that designates the program or

procedure the system executes during the job

step.

This positional parameter is often coded like a

keyword parameter using either PGM= or

PROC=.

The Positional Parameter

//STEP1 EXEC procedure-name

//STEP2 EXEC PROC=procedure

//STEP1 EXEC PGM=program-name

Positional Parameter

Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 54 of 107

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.

The PGM= Positional Parameter

Payroll

//JOB1 JOB 3SPO3W,CLASS=B

//STEP1 EXEC PGM=PAYROLL

Program

Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 55 of 107

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.

The PROC= Positional Parameter

//LA$JOE JOB 3SPO3W,CLASS=B

//STEP1 EXEC PROC=MYPROC

Procedure

Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 56 of 107

If you omit the PGM= or PROC= keyword, the

operating system automatically looks for a

procedure by the specified name. Shown here is

an example of the syntax when omitting

PROC= keyword in an EXEC statement is shown.

For example, to call a procedure named

MYPROC from a step named STEP3, you will

need to code the EXEC statement as shown on

the right.

Omitting the PROC= Keyword

//STEP3 EXEC procedure-name

//STEP3 EXEC MYPROC

Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 57 of 107

JCL errors occur if you, as a JCL programmer fail

to follow any of the coding rules regarding the

PGM and PROC positional parameters.

For example, the misspelling of PGM (as PGR) in

the EXEC statement shown here returns a JCL

error.

Positional Parameter Coding Errors

//LA$JOE JOB 3SPO3W,CLASS=B

//STEP1 EXEC PGR=IEFBR14

Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

Concepts

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 58 of 107

In addition to programs, you can use the EXEC

statement to invoke a cataloged procedure, which

is a set of JCL statements that you place in a

library and retrieve by its name.

A procedure can contain one or more EXEC

statements, with associated DD statements.

Procedures

Concepts

Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 59 of 107

You may code keyword parameters on the EXEC

statement in any order, following the program or

procedure name being executed.

You can use any of the keyword parameters

shown here on the EXEC statement.

If you code one of these keyword parameters on

the EXEC statement, the keyword parameter

value will apply only to that step.

The two keyword parameters used most

frequently with the EXEC statement are:

• The PARM parameter

• The COND parameter

Keyword Parameters

PGM=PROGA,keyword

ACCT

RD

DYNAMNBR

ADDRSPC

PERFORM

REGION

PARM

COND

TIME

DPRTY

CCSID

Concepts

Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 60 of 107

The PARM Parameter

What does the PARM parameter do?

The PARM parameter passes information to the executing program. Some programs accept information from

the PARM parameter about how many times to execute.

For example, a program may need to know whether a report cycle is "annual" or "monthly".

The records the program uses vary depending on which value is passed to it.

Similarly, the PARM parameter can supply a password to the program that is required before the program

executes.

The syntax for the PARM parameter is:

PARM=(SUBPARAMETER,SUBPARAMETER)

Unit: Coding EXEC Statements Topic: The PARM Parameter

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 61 of 107

Rules for Coding the PARM Parameter

The general syntax and rules for coding the PARM parameter are:

• The PARM parameter can include up to 100 characters

• The PARM parameter can consist of several subvalues separated by commas.

• Subparameters must be enclosed in parentheses or apostrophes

• Special characters must be enclosed in apostrophes

Unit: Coding EXEC Statements Topic: The PARM Parameter

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 62 of 107

This EXEC statement passes one value (MONTHLY) as input to a program named REPORT.

Coding the PARM Parameter – Example 1

//JOB1 JOB 766,SMITH

//RUN#2 EXEC PGM=REPORT,

// PARM=MONTHLY

REPORT

PARM=MONTHLY

PARM Parameter

Unit: Coding EXEC Statements Topic: The PARM Parameter

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 63 of 107

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.

Coding the PARM Parameter – Example 2

//JOB1 JOB 766,SMITH

//RUN#2 EXEC PGM=REPORT,

// PARM=’10-31-98’

REPORT

PARM=’10-31-98’

PARM Parameter

Unit: Coding EXEC Statements Topic: The PARM Parameter

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 64 of 107

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.

Coding the PARM Parameter – Example 3

//JOB1 JOB 766,SMITH

//RUN#2 EXEC PGM=REPORT,

// PARM=(MONTHLY,’10-31-98’)

REPORT

PARM=(MONTHLY,’10-31-98’)

PARM Parameter

Unit: Coding EXEC Statements Topic: The PARM Parameter

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 65 of 107

At the end of this topic, you will be able to:

• Explain the purpose of the COND parameter in an EXEC statement

• Code the COND parameter and the various COND subparameters in an EXEC statement

Topic Objectives

Introduction

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 66 of 107

The COND Parameter

What does the COND parameter do?

To provide control over the whole job, you can code the condition (COND) parameter on the JOB statement.

You can also code it on the EXEC statement to control an individual step in the job.

The syntax for the COND parameter is:

COND=(code,operator)

When you use the COND parameter on an EXEC statement, the parameter specifies the conditions

that allow the system to bypass a step by testing return codes from any or all previous steps.

If the result of any test is true, the system will bypass the step.

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 67 of 107

Like the JOB statement COND parameter, each

test in an EXEC statement COND parameter has

its own operator.

This operator is independent of any other

operators in any other tests.

COND Parameter Operators

GT

GE

EQ

NE

LT

LE

Operator Meaning

Greater than

Greater than or equal to

Equal to

Not equal to

Less than

Less than or equal to

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 68 of 107

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

COND Parameter – An Example

DELETE

//JOB1 JOB 778,SMITH

//EXAMPLE2 EXEC PGM=DELETE

//EXAMPLE3 EXEC PGM=UPDATE,

// COND=(8,GT)

//DD1 DD DSN=INPUT

COND=(8,GT)

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 69 of 107

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

COND Parameter – An Example (cont’d)

DELETE

//JOB1 JOB 778,SMITH

//EXAMPLE2 EXEC PGM=DELETE

//EXAMPLE3 EXEC PGM=UPDATE,

// COND=(8,GT,EXAMPLE2)

//DD1 DD DSN=INPUT

COND=(8,GT,STEP1)

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 70 of 107

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.

EVEN Subparameter – An Example

//JOB1 JOB 778,SMITH

//EXAMPLE1 EXEC PGM=STEP1

//EXAMPLE2 EXEC PGM=STEP2

//EXAMPLE3 EXEC PGM=STEP3

//EXAMPLE4 EXEC PGM=STEP4,

// COND=EVEN

//DD1 DD DSN=INPUT

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 71 of 107

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.

ONLY Subparameter – An Example

//JOB1 JOB 778,SMITH

//EXAMPLE1 EXEC PGM=STEP1

//EXAMPLE2 EXEC PGM=STEP2

//EXAMPLE3 EXEC PGM=STEP3

//EXAMPLE4 EXEC PGM=STEP4,

// COND=ONLY

//DD1 DD DSN=INPUT

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 72 of 107

The EVEN and ONLY subparameters cannot

appear on the same step. They are mutually

exclusive.

However, EVEN or ONLY can be

coded in place of one of the eight return code

test allowed for each step. The order in which

tests are coded does not matter.

For example, the two EXEC statements shown

here mean the same thing.

If a job step terminates abnormally, the systembypasses all subsequent steps unless they havebeen coded with an EVEN or ONLYsubparameters on the COND parameter.

Using the EVEN & ONLY Subparameters

//ST4 EXEC PGM=PROG7,

// COND=((10,EQ,STEP5),EVEN)

//ST4 EXEC PGM=PROG7,

// COND=(EVEN,(10,EQ,STEP5))

Concepts

Unit: Coding EXEC Statements Topic: The COND Parameter

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 73 of 107

You can use private libraries to store programs.

If you want to invoke a program called MYPROG

which is stored in a private library, you must tell

the operating system the name of the private

library by coding a special DD statement named

JOBLIB.

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.

Private Program Libraries

//JOB1 JOB 776,SMITH

//JOBLIB DD DSN=LIBRARY,

// DISP=SHR

//STEP1 EXEC PGM=MYPROG

Unit: Coding EXEC Statements Topic: The System Library

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 74 of 107

At the end of this topic, you will be able to:

• Define the purpose of the STEPLIB DD statement

• Distinguish between the JOBLIB and STEPLIB DD statements

• Code a STEPLIB statement on a job

Topic Objectives

Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 75 of 107

If most of the programs for a job reside in

SYS1.LINKLIB or LINKLIST and only a few are in

private libraries, it makes more sense to direct the

system to search a private library on a

step-by-step basis.

This saves processing time by eliminating

unnecessary searching.

To search a private library directly you use a

special DD statement called STEPLIB DD

statement as shown.

The STEPLIB DD Statement

//STEP1 EXEC PGM=PROGA

//STEPLIB DD DSN=MYLIB,DISP=SHR

The STEPLIB DD statement can be placed anywhere in a job step but it typically appears after an EXEC statement.

Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 76 of 107

Just like a JOBLIB DD statement, the STEPLIB

DD statement searches a private library for a

specified program.

But, the STEPLIB DD statement is in effect only

for the duration of the step it follows.

Comparison between JOBLIB and STEPLIB DD Statements

//JOB1 JOB 777,SMITH

//STEP1 EXEC PGM=PROGA

//STEP2 EXEC PGM=MYPROG

//STEPLIB DD DSN=LIBRARY,

// DISP=SHR

//STEP3 EXEC PGM=PROGB

Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

Concepts

Continued…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 77 of 107

What if a STEPLIB and JOBLIB DD statement

both appear in a job?

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.

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.

Comparison between JOBLIB and STEPLIB DD Statements (cont’d)

//JOB1 JOB 777,SMITH

//JOBLIB DD DSN=USER1

//STEP1 EXEC PGM=MYPROG

//STEPLIB DD DSN=LIBRARY,

// DISP=SHR

Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 78 of 107

At the end of this topic, you will be able to:

• Identify the various types of job conditions that an IF/THEN/ELSE/ENDIF statement construct can test

• Code IF/THEN/ELSE/ENDIF statement constructs

• Correct invalid IF/THEN, ELSE, and ENDIF JCL statements

• State reasons why IF/THEN/ELSE/ENDIF JCL errors occur

Topic Objectives

Introduction

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 79 of 107

Syntax for the IF/THEN/ELSE/ENDIF Statement Construct

What is the syntax for an IF/THEN/ELSE/ENDIF statement construct?

The syntax for coding an IF/THEN/ELSE/ENDIF statement construct is:

//name IF (relational-expression) THEN

//name JCL statement(s) to be executed when relational-expression is true

//name ELSE

//name JCL statement(s) to be executed when relational-expression is false

//name ENDIF

The IF/THEN/ELSE/ENDIF statement construct can be coded anywhere in the job after the JOB statement.

The name field in the IF/THEN/ELSE/ENDIF statement construct is optional but if specified it must follow the coding rules for names in JCL statements.

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 80 of 107

What are the rules for valid name fields?

Even though the name field is optional, if one iscoded then it must follow the normal coding rulesfor names in JCL statements, such as:

• The name must begin in position 3. If you do not code a name then leave the position blank

• The name must be unique within the job

• The first character of the name has to be alphabetical or national and it cannot be a number

• The remaining characters can be alphanumeric or national

• The name field must be followed by at least one space

The Name Field

//CHECK1 IF (relational-expression) THEN

//UNIQUE IF (relational-expression) THEN

//PROG#1 IF (relational-expression) THEN

// CHECK1

//TOOMANYCHARS

//CHECK#2IF

Valid JCL Names

Invalid JCL Names

(Does not begin in position 3)

(More than eight characters)

(Needs blank space after name)

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 81 of 107Concepts

What is the Operation Field?

The operation field contains the operators IF, ELSE, or ENDIF.

What are the characteristics of the IF statement?

The IF statement always precedes a relational-expression and the identifier THEN.

Following the IF statement are all of the JCL statements to be executed when the relational-expression is true.If there are none, then the IF statement should be followed immediately by the ELSE statement.

The Operation Field – The IF Statement

// UNIQUE NAME IF RELATIONAL-EXPRESSION COMMENT

Identifier

Field

Name

Field

Operation

Field

Relational-Expression

Field

Comment

Field

... JCL statement to be executed when the expression is TRUE

THEN

Identifier

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 82 of 107Concepts

What are the characteristics of the ELSE statement?

Following the ELSE statement are all the JCL statements to be executed when the relational-expression is

false. If there are none, then the ELSE statement can be omitted.

The ELSE statement has no parameters.

Anything following the ELSE operator is considered a comment.

The Operation Field – The ELSE Statement

// UNIQUE NAME

Identifier

Field

Name

Field

Operation

Field

Comment

Field

ELSE

... JCL statement to be executed when the expression is FALSE

COMMENT

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 83 of 107Concepts

What are the characteristics of the ENDIF statement?

The required ENDIF statement signifies the end of the IF/THEN/ELSE/ENDIF statement construct.

There must be at least one EXEC statement following either the IF statement or the ELSE statement.

Anything coded after the ENDIF statement is considered a comment by the operating system.

The Operation Field – The ENDIF Statement

// UNIQUE NAME

Identifier

Field

Name

Field

Operation

Field

Comment

Field

ENDIF COMMENT

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 84 of 107

What is the relational-expression field?

The relational-expression field follows the IF

statement and specifies the condition that is

evaluated at execution.

Depending on the values in the expression, the

result of the condition is either true or false.

In the example, the first statement tests for a

return code of less than eight. Hence the

relational-expression is RC<8.

Also the relational-expression can be enclosed in

parentheses, as shown in second statement.

The Relational-Expression Field

Continued…

There must be at least one space between the IF operator and relational-expression field and similarly one space between the expression and the THEN operator.

//TESTRC IF RC<8 THEN

//TESTRC IF (RC<8) THEN

Relational-Expression Field

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 85 of 107

Relational-expressions can be continued on more

than one line.

To continue the expression, break the expression

on a valid blank space and continue on the next

line using columns 4 through 16.

The Relational-Expression Field (cont’d)

Comments cannot be placed on the line you are continuing as the system will try to evaluate the comments as part of the expression.

Continued…

//TESTRC IF (ABEND | RC<8 | // RC=16) THEN

Comment

goes here

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 86 of 107

What are the characteristics of a Comparison

Operator?

Comparison operators compare a relational-

expression keyword to a numeric value. The

result of the comparison is either true or false.

The comparison operators are either alphabetic or

arithmetic.

Comparison Operators

GT or >

GE or >=

NG or ¬>

EQ or =

NE or ¬=

LT or <

LE or <=

NL or ¬<

Operator Meaning

Greater than

Greater than or equal to

Not greater than

Equal to

Not equal to

Less than

Less than or equal to

Not less than

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 87 of 107

In this example, the statement tests if a return

code is equal to 8.

The relational-expression (RC=8) must be both

preceded and followed by at least one space.

No spaces are required before or after an

arithmetic operator, such as = or >.

At least one space is required both before and

after alphabetic comparison operators, such as

EQ or GT.

Comparison Operators – An Example

The use of parentheses in the relational-expression is optional, but it is useful when coding combinations of expressions.

//TESTIT IF (RC=8) THEN

//TESTIT IF RC EQ 8 THEN

Spaces are not required

Spaces are required

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 88 of 107

What are the characteristics of the AND

operator?

The AND (&) operator returns a value only if both

relational-expressions are true.

For example, to test if a return code is between 8

and 24:

//TEST1 IF (RC>8 & RC<24) THEN

Logical Operators- AND

The AND operator must be preceded and followed by at least one space.

RC = 12

The condition

is true

IF (RC>=8 & RC<=24) THEN

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 89 of 107

What are the characteristics of the OR

operator?

The OR (|) operator returns a true value if either of

the relational-expression is true.

For example, to test if a return code is either

equal to 8 or 16:

//TEST2 IF (RC>8 | RC<16) THEN

Logical Operators- OR

The OR operator must be preceded and followed by at least one space.

RC = 12

IF (RC>8 | RC<16) THEN

Concepts

Topic: IF/THEN/ELSE/ENDIF Construct

The condition is false

Unit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 90 of 107

What are the characteristics of the NOT

operator?

The NOT (¬) operator reverses the testing of a

relational-expression. The system evaluates the

NOT operator before any comparisons or logical

operators.

For example, to test if a return code is not equal

to 12:

//TEST3 IF ¬(RC=12) THEN

Logical Operators- NOT

The NOT operator does not require a space to separate it from the expression it is reversing.

RC = 8

IF ¬(RC>12) THEN

Concepts

Topic: IF/THEN/ELSE/ENDIF Construct

The condition

is true

Unit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 91 of 107

Relational-Expression Keywords

What are the characteristics of relational-expression keywords?

Relational-expression keywords are used to test a return code, abend condition or abend completion code, or

to test if a step began executing. The relational-expression keywords are:

• RC

• ABEND

• ¬ ABEND

• ABENDCC

• RUN

• ¬RUN

Preceding the keyword with a step name relates the expression to a specific job step.

Syntax: stepname.keyword

Preceding the keyword with both a step name and procedure step name relates the expression to a specific

procedure step.

Syntax: stepname.procstepname.keyword

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 92 of 107

What are the characteristics of the RC

keyword?

RC represents the highest return code received

from a previous job step.

In the example, the first statement checks if the

previous job step had a return code greater than

4.

The second statement tests if a prior job step

named COMPILE produced a return code greater

than 4.

The third one checks if a specific procedure,

PROG1 in the job step COMPILE, produced a

return code greater than 4.

Relational-Expression Keywords - RC

//TESTRC IF (RC>4) THEN

//TESTRC IF (COMPILE.RC>4) THEN

//TESTRC IF COMPILE.PROG1.RC>4 THEN

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 93 of 107

What are the characteristics of the ABEND

keyword?

The keyword ABEND tests for abnormal

termination from any previous job step.

The syntax used for ABEND is:

//name IF ABEND THEN

Or

//name IF ABEND = TRUE THEN

Both these statements will test for an abnormal

termination in any of the previous steps.

Relational-Expression Keywords - ABEND

Both formats can be preceded with a step name or procedure step name to check specific job steps or procedure steps for abnormal termination.

//TEST IF ABEND THEN

//TEST IF TEST1.ABEND = TRUE THEN

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 94 of 107

What are the characteristics of the ABENDCC keyword?

The relational-expression keyword ABENDCC tests for a specific system abend completion code or user

defined abend completion code from any previous job step.

Relational-Expression Keywords - ABENDCC

Both formats can be preceded with a step name or procedure step name to test the abend code from specific job steps or procedure steps.

ABENDCC = Sxxx ABENDCC = Uxxxx

S = Abnormal system completion code

U = Abnormal user-defined completion code

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 95 of 107

The first statement tests for an abnormal system

completion code of 0C1 in the previous job step.

The second statement tests for an abnormal

user-defined completion code of U0100 in a prior

job step named RUNPGM in the previous job

step.

ABENDCC – An Example

//TST4ABND IF ABENDCC = S0C1 THEN

//TST4ABND IF RUNPGM.ABENDCC = // U0100 THEN

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 96 of 107

The ELSE Clause – An Example

To illustrate the working of the ELSE clause consider the following JCL code:

//TESTRUN IF STEP1.RUN THEN

//GOOD EXEC PGM=CREATE

// ELSE

//ERROR EXEC PGM=DELFILES

// ENDIF

//STEP2 EXEC PGM=COMPRESS

The THEN clause contains one JCL statement named GOOD. The Program CREATE, specified in the

GOOD EXEC statement, will not be executed unless STEP1 has been executed successfully.

If STEP1 failed to execute, then a program DELFILES (specified in the statement named ERROR) will be

executed as it is contained under the ELSE clause.

Irrespective of whether STEP1 was executed successfully or not, the program COMPRESS specified in

STEP2 will run as if it is not part of the IF/THEN/ELSE/ENDIF statement construct.

Concepts

Topic: IF/THEN/ELSE/ENDIF ConstructUnit: Conditional Processing

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 97 of 107

In a nested conditional construct the THEN clause

or the ELSE clause (or both) will contain an

additional IF/THEN/ELSE/ENDIF construct.

Each additional construct will have its own

corresponding IF/THEN,ELSE and ENDIF

statements.

The IF/THEN/ELSE/ENDIF statement construct

can be nested up to 15 levels.

The example shows a nested conditional

construct where the value of return code of a

program determines the next step.

Nesting Conditional Constructs

//COMPPGM EXEC PGM=COMPILE//CHKCOMP IF (COMPPGM.RC<=4) THEN//LNKPGM EXEC PGM=LINK//CHKLKED IF (LNKPGM.RC>4) THEN//DELPGM EXEC PGM=DELETE// ELSE//RUNPGM EXEC PGM=MYPROG// ENDIF// ENDIF//COMPLIB EXEC PGM=COMPRESS

Concepts

Unit: Conditional Processing Topic: Nesting Conditional Constructs

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 98 of 107

This unit describes the purpose, function and the format of certain special DD statements like backward

references.

This unit also describes DD statements that can be used to concatenate data sets and identify dummy data

sets.

DD statements that request storage dumps are also discussed in this unit.

Unit Introduction

Unit: Using Special DD Statements

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 99 of 107

At the end of this unit, you will be able to:

• Code a DD statement to use information from preceding JCL statements

• Identify the purpose of data set concatenation

• Code JCL to concatenate a data set

• Code a DD statement to indicate that a data set is to be ignored for the current program execution

• Identify the purpose of special ddnames

Unit Objectives

Unit: Using Special DD Statements

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 100 of 107

What is Backward Reference?

A typical JCL job step may use or create a

number of data sets, each requiring a variety of

parameter values.

Backward reference is a coding technique that

directs the system to copy parameter values from

preceding DD statements within the current job.

How does this technique help?

Backward reference technique is more efficient as

it saves the programmer from repetitive coding of

information.

Backward Reference

Unit: Using Special DD Statements Topic: Using Backward Reference

DD PARAMETERS

PGM VOL

DSN DCB

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 101 of 107

Four common backward references are:

• PGM Reference: Points to a previous data set to specify a program name

• DSN Reference: Points to a previous data set name

• VOL Reference: Points to a previous volume serial number

• DCB Reference: Points to DCB attributes defined in another previous DD statement

Types of Backward References

Unit: Using Special DD Statements Topic: Using Backward Reference

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 102 of 107

Syntax for Backward Reference

The general form of a backward reference is as

follows:

• To refer back to a prior DD statement within the same job step:

Keyword=*.ddname

• To refer back to a DD statement in a prior job step:

Keyword=*.stepname.ddname

• To refer back to a DD statement contained in a cataloged procedure called by a previous step: Keyword=*.stepname.procstep.ddname

The keyword in each statement is either PGM, DSN, VOL or DCB.

Unit: Using Special DD Statements Topic: Using Backward Reference

keyword=*.ddname or keyword=*.stepname.ddname

//JOB1

//STEP1 EXEC

//DD1 DD DSN=ABC//DD2 DD DSN=...//DD3 DD DSN=*.DD1

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 103 of 107

The general form of a PGM backward reference is as follows:

//STEP EXEC PGM=*.stepname.ddname

Syntax for PGM Backward Reference

Unit: Using Special DD Statements Topic: Using Backward Reference

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 104 of 107

A PGM backward reference is often used following a linkage edit step, in which a load module (program) isstored in a temporary data set. PGM backward reference is used in coding a later step that executes the program. The reference specifies the data set containing the program from the previous step.

PGM Backward Reference – Example 1

Unit: Using Special DD Statements Topic: Using Backward Reference

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 105 of 107

PGM Backward Reference – Example 2

In the example shown, the LINKEDIT program

instructs the system to place a load module in a

temporary library.

The ddname is SYSLMOD and the data name is

&&GOSET(GO).

The DISP parameter specifies that the data is

NEW and is to be PASSed to another step.

STEPA executes the program, using a PGM

backward reference.

Unit: Using Special DD Statements Topic: Using Backward Reference

//LKED EXEC PGM=LINKEDIT//SYSLMOD DD DSN=&&GOSET(GO),// DISP=(NEW,PASS),// UNIT=SYSDA,SPACE=(1024,(200,20,1))//STEPA EXEC PGM=*.LKED.SYSLMOD

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 106 of 107

DSN Backward Reference – An Example

Consider a payroll job consisting of several steps,

all referring to the same data set. The job needs

to be executed each week using a data set that

contains the week’s transactions.

This requires that, each week the data set name

must be changed in the order WEEK1, WEEK2

and so on.

By using a DSN backward reference, the data set

can be retrieved each week by changing only one

DD statement, DD1.

Continued…

Unit: Using Special DD Statements Topic: Using Backward Reference

//STEP1 EXEC PGM=PROG1//DD1 DD UNIT=SYSDA,// VOL=SER=PACK12.SPACE=(800,(200,20,2)),// DISP=(NEW,PASS),DSN=WEEK1//STEP2 EXEC PGM=PROG2//DD2 DD DSN=*.STEP1.DD1.DISP=(OLD,KEEP)

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 107 of 107

Consider an example where PROGA creates and catalogs a data set named XYZ. XYZ is to reside on the

same volume as an existing, previously catalogued data set named ABC.

To refer the system to data set ABC, a VOL backward reference can be coded as follows:

//STEP1 EXEC PGM=PROGA

//DD1 DD DSN=XYZ,

// DISP=(NEW,CATLG),

// VOL=REF=ABC

VOL Backward Reference – Example 1

Unit: Using Special DD Statements Topic: Using Backward Reference

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 108 of 107

VOL Backward Reference - Example 2

In this example the backward reference refers to a

specific volume serial number coded on a prior

DD statement.

The data set XYZ will be created on the volume

referred to by the DD statement DD2 (volume

123456).

Unit: Using Special DD Statements Topic: Using Backward Reference

Concepts

//STEPA EXEC PGM=PROGA//DD2 DD DSN=ABC,VOL=SER=123456,// DISP=SHR,UNIT=SYSDA//DD1 DD DSN=XYZ,// DISP=(NEW,CATLG),// VOL=REF=*.DD2,…

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 109 of 107

DCB Backward Reference – An Example

Assume that in STEP2 you want to create a

data set with the same parameters as a data set

in STEP1.

The code shown ensures that the attributes on the

DD2 statement are the same as those on the DD1 statement.

Unit: Using Special DD Statements Topic: Using Backward Reference

//STEP1 EXEC PGM=PROG1//DD1 DD DCB=(RECFM=FB,// LRECL=80,// BLKSIZE=800)...//STEP2 EXEC PGM=PROG2 //DD2 DD DCB=*STEP1.DD1,...

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 110 of 107

A DCB backward reference can also be used to

override or add to the subparameters coded on a

previous statement.

The format for overriding a previous statement

is as follows:

DCB=(*.stepname.ddname,list-of

attributes)

The values of the DCB parameters being referred

will be overridden by the values that are being

coded. Any attributes that do not match the DCB

being referred will be added.

DCB Backward Reference – Overriding

Unit: Using Special DD Statements Topic: Using Backward Reference

Continued…

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 111 of 107

Consider a cost ledger system to produce a

monthly cost summary file. At the year end, it is

required to process all 12 monthly data sets to

produce an annual report. All the data sets are

concatenated so that they can be processed

sequentially.

In this example, the program uses a ddname of

LEDGER and the monthly data sets are named

JAN, FEB, MAR and so on.

The operating system draws the concatenated

data sets sequentially, treating them as a single

logical data set.

Data Set Concatenation – An Example

Unit: Using Special DD Statements

Concepts

Topic: Concatenating Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 112 of 107

The JCL here shows the concatenation of the

monthly data sets considered in the LEDGER

example.

The last data set concatenated to LEDGER is

DEC.

The occurrence of the ddname SUM indicates

that the data set (ACCT.1999) is to be processed

separately from the LEDGER data sets.

JCL for Data Set Concatenation – An Example

Unit: Using Special DD Statements

//LEDGER DD DSN=JAN,DISP=SHR// DD DSN=FEB,DISP=SHR

. . .

// DD DSN=DEC,DISP=SHR//SUM DD DSN=ACCT.1999,DISP=SHR

Concepts

Topic: Concatenating Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 113 of 107

Each data set that is referred by a program should

have a ddname. The JCL for the program must

contain the corresponding DD statements.

If a data set is not coded by a DD statement, then

the program will abnormally end (ABEND) as

shown.

When an input data set is optional for the

program’s processing or when an output data set

is not required dummy data sets can be used.

Overview

Unit: Using Special DD Statements

Concepts

Topic: Dummy Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 114 of 107

Dummy data sets can be specified in DD statements by doing one of the following:

• Coding DUMMY as the first DD parameter

Syntax:

//ddname DD DUMMY

• Coding DSN=NULLFILE

Syntax:

//ddname DD DSN=NULLFILE

Specifying Dummy Data Sets

NULLFILE is a reserved word and a data set cannot be named as NULLFILE.

Unit: Using Special DD Statements

Concepts

Topic: Dummy Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 115 of 107

Consider a payroll program named PAY

that processes separate input data sets. The

ddname TIMECDS refers to weekly time cards

and the ddname ADJUST refers to adjustments to

previous pay period information.

The job stream must include:

//STEPA EXEC PGM=PAY

//TIMECDS DD ---

//ADJUST DD ---

.

.

.

Dummy Data Sets – An Example

Unit: Using Special DD Statements

Concepts

Continued…

Topic: Dummy Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 116 of 107

Even if there are no adjustments for PAY process, DD statement for ADJUST must be included.

To tell the system that there is no ADJUST data set code can be written as follows:

//STEPA EXEC PGM=PAY

//TIMECDS DD ----

//ADJUST DD DUMMY

If the data set described by the DD statement named ADJUST is referred to by the PAY program, an

immediate end-of-file occurs. The program will continue as if it has processed the entire data set.

Dummy Data Sets – An Example (cont’d)

Unit: Using Special DD Statements

Concepts

Topic: Dummy Data Sets

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 117 of 107

What are Storage Dumps?

When a program abnormally terminates, storage

dumps are used as a debugging tool to find clues

to the cause for abnormal ending.

Storage dumps are not the most effective

debugging tool.

The main drawbacks of storage dumps are:

• They are difficult to read since they are printed in hexadecimal code

• Printing storage dumps is time

consuming

Storage Dumps

Unit: Using Special DD Statements

Concepts

Topic: Storage Dumps

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 118 of 107

Special DDnames

These reserved ddnames request storage dumps in the event that a program terminates abnormally:

• SYSUDUMP: Requests a formatted dump of the processing program area. It is most generally used

for debugging problem programs.

• SYSABEND: Requests a formatted dump of the processing program area, system programs and

the system control blocks. It is often spooled for printing, although it may be written

onto any output device.

• SYSMDUMP: Requests an unformatted dump of the processing program area and the system

nucleus in machine-readable form. It is generally directed to tape (or to direct access

storage) to allow subsequent processing by a dump analysis utility.

Unit: Using Special DD Statements

Concepts

Topic: Storage Dumps

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 119 of 107

It is necessary to plan ahead for a possible storage

dump.

To obtain a dump, the SYSUDUMP, SYSABEND,

or SYSMDUMP DD statements must be coded in

the JCL for each job step from which a dump needs

to be obtained.

The example shown uses SYSUDUMP DD statement.

If STEP1 or STEP2 terminates abnormally, the

system creates a dump of the program storage area.

Handling Storage Dumps

Unit: Using Special DD Statements

//STEP1 EXEC PGM=PROG1//SYSDUMP DD SYSOUT=X//DD1 DD ...//STEP2 EXEC PGM=PROG2//SYSDUMP DD SYSOUT=X

Concepts

Topic: Storage Dumps

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 120 of 107

At the end of this unit, you will be able to:

• Specify what factors determine if a procedure meets the requirements of a job

• Invoke a procedure, making temporary alterations to it if necessary

• Add, override or nullify parameters on procedure step EXEC statements

• Correctly sequence multiple changes to EXEC statement parameters

Unit Objectives

Unit: Modifying EXEC Parameters

Introduction

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 121 of 107

A procedure listing is obtained and examined to

ensure that it meets the following two criteria:

• The procedure invokes the proper programs in the desired sequence

• Most of the DD statements are usable without major alteration

Identifying Analysis Criteria

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 122 of 107

Consider a case in which a company buys goods

wholesale from several manufacturers and

markets them retail to other customers.

Each week the customer order department

creates a transaction file that contains new

customer orders for the week.

A list of orders to be filled is sent to the

warehouse and an invoice is sent to each

customer. The order list and associated invoices

are printed once a week.

Identifying Analysis Criteria - An Example

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

Continued…

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 123 of 107

A program named PROG1 checks the weekly

input transactions against entries in a master

customer data set. Valid transactions are written

to a new data set used as input for another

program named PROG2.

PROG1 refers to the following data sets:

DD1: Refers to the input transactions

DD2: Refers to the master customer data set

DD3: Refers to the transaction exception report

DD4: Refers to the set of valid transactions that

are passed to PROG2

Identifying Analysis Criteria - An Example (cont’d)

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

Continued…

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 124 of 107

Shown on the right is the procedure named

TRANSACT that is used to accomplish this task.

A procedure listing is obtained to determine:

• If it uses the required programs in the required sequence

• If it uses appropriate data sets

Identifying Analysis Criteria - An Example (cont’d)

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

//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,// UNIT=SYSDA,DISP=(NEW,PASS),// SPACE=(TRK,(1,1))//PSTEP2 EXEC PGM=PROG2,TIME=5//DD5 DD DSN=&&VALID,// DISP=(OLD,DELETE)//DD6 DD SYSOUT=A

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 125 of 107

The listing for the procedure TRANSACTindicates the following:

The procedure executes 2 programs: PROG1 and

PROG2.

PROG1 uses the following data sets:

• A cataloged data set named INTRAN(DD1 DD statement)

• A cataloged data set named MASTER(DD2 DD statement)

• SYSOUT class A output (DD3 DDstatement)

• A temporary data set named &&VALIDthat is passed to PROG2 (DD4 DD statement)

Analysis Explanation

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

Continued…

//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,// UNIT=SYSDA,DISP=(NEW,PASS),// SPACE=(TRK,(1,1))//PSTEP2 EXEC PGM=PROG2,TIME=5//DD5 DD DSN=&&VALID,// DISP=(OLD,DELETE)//DD6 DD SYSOUT=A

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 126 of 107

PROG2 uses the following data sets:

• A temporary data set named &&VALID,

which is passed from PROG1 (DD5 DD

statement)

• SYSOUT class A output (DD6 DD

statement)

In addition, a TIME parameter is included on the

PSTEP1 and PSTEP2 EXEC statements to

restrict the amount of time the programs are

permitted to use the central processor.

Analysis Explanation (cont’d)

Unit: Modifying EXEC Parameters Topic: Analyzing Procedures

Continued…

//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,// UNIT=SYSDA,DISP=(NEW,PASS),// SPACE=(TRK,(1,1))//PSTEP2 EXEC PGM=PROG2,TIME=5//DD5 DD DSN=&&VALID,// DISP=(OLD,DELETE)//DD6 DD SYSOUT=A

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 127 of 107

A procedure listing helps a programmer to analyze

the procedure for its usability. In some cases a

procedure might satisfy all the basic requirements

for usability, but might need some minor

alterations.

This can be done by changing the EXEC and DD

parameters when the procedure is invoked.

However, these alterations are applicable only for

one invocation. They do not permanently modify

the procedure definition.

Coding Changes

Unit: Modifying EXEC Parameters Topic: Changing EXEC Parameters

Continued…

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 128 of 107

Changes can be made to procedure EXEC

statement parameters such as TIME, ACCT, and

PARM.

The programmer can change these parameters

in the following ways:

• Override the parameters on the

procedure EXEC statement

• Nullify parameters on the procedure

EXEC statement

• Add parameters to the procedure EXEC

statement

Coding Changes (cont’d)

Unit: Modifying EXEC Parameters Topic: Changing EXEC Parameters

//STEP1 EXEC procedure name,parameter

//DD1 DD parameter

//DD2 DD parameter Override

Nullify

Add

New DD Statement

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 129 of 107

An override statement is used to change an

existing parameter value.

Consider the TRANSACT procedure discussed

in Unit 3, Topic 1 – Analyzing procedures.

The procedure definition is shown on the right.

Note that the time that PROG1 can run is 1

minute 30 seconds.

Assume that for a particular week, the

transaction file to be processed is too large and

the time that PROG1 can run needs to be

increased to 3 minutes.

Overriding Statement Parameters

Unit: Modifying EXEC Parameters Topic: Override Statements

Continued…

Concepts

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

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 130 of 107

To override the original time parameter, the

TRANSACT can be invoked with the following

EXEC statement:

//JSTEP EXEC TRANSACT,TIME.PSTEP1=3

Shown on the right is the resulting JCL.

Note the new parameter in the resulting JCL.

However, this override is only temporary. The

procedure definition does not change. The next

time the procedure is invoked, it will revert to the

original definition.

Overriding Statement Parameters (cont’d)

Unit: Modifying EXEC Parameters Topic: Override Statements

//PSTEP1 EXEC PGM=PROG1,TIME=3//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

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 131 of 107

Addition statements are used to add parameters to a procedure. The programmer can code additions on the

EXEC statement that invokes the procedure.

Consider the TRANSACT procedure discussed in Unit 3, Topic 1 – Analyzing procedures. Assume that a

programmer wants to supply the current date for PROG1.

This parameter can be coded in the following way while invoking the procedure:

//JSTEP EXEC procedurename,

// parameter.procstepname=value

//JSTEP EXEC TRANSACT,

// PARM.PSTEP1=’01/29/99’

Adding Parameters to a Procedure

Unit: Modifying EXEC Parameters Topic: Addition Statements

Addition

Continued…

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 132 of 107

The following EXEC statement supplies the

current date for PROG1 and PROG2:

//JSTEP EXEC TRANSACT,

// PARM.PSTEP1=’01/29/91’,

// PARM.PSTEP2=’01/29/91’

The resulting JCL is shown on the right.

Adding Parameters to a Procedure (cont’d)

Unit: Modifying EXEC Parameters Topic: Addition Statements

//PSTEP1 EXEC PGM=PROG1,TIME=(1,30)// PARM=’01/29/91’//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// PARM=’01/29/91’//DD5 DD DSN=&&VALID,// DISP=(OLD,DELETE)//DD6 DD SYSOUT=A

Concepts

z/OS MVS JCL Introduction

© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 133 of 107

Consider the TRANSACT procedure discussed

in Unit 3, Topic 1 – Analyzing procedures.

The following alterations are to be made to the

EXEC statement operands in the 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 PSTEP2

The JCL statements on the right show how to

combine these alterations on the EXEC statement

that invokes the procedure.

Sequencing Multiple Changes – An Example

Unit: Modifying EXEC Parameters Topic: Sequencing Multiple Changes

//JSTEP EXEC TRANSACT,TIME.PSTEP1=3,// PARM.PSTEP1=’01/29/99’,// TIME.PSTEP2=,// PARM.PSTEP2=’01/29/99’

Concepts