Sie sind auf Seite 1von 133

z/OS MVS JCL Introduction

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

z/OS MVS JCL Introduction

UNIT

Coding JOB Statements


Topics:
The JOB Statement
The JOB Name
The JOB Parameter Field
Keyword Parameters
Complete JOB Statement
JOB Statement Parameters

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

Page 2 of 107

z/OS MVS JCL Introduction


Unit: Introduction to JCL

Topic: Introduction

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 jobs 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:

Concepts

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

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

Page 3 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements
Unit Objectives
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

Introduction

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

Page 4 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Statement

Defining a JOB Statement


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.

Concepts

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

Page 5 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Statement

The JOB Name


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.

//JOB1

The JOB name must begin in position 3 with no


spaces between it and the identifier.

JOB Name

Concepts

JOB

776,M.FLURY

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

Page 6 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Statement

The Operation Field


The operation field follows the job name. For a
JOB statement, the operator in the operation field
is JOB.

//JOB1

JOB

776,M.FLURY

Operation
Field

Always separate the operation


field and the job name by at
least one space.
Concepts

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

Page 7 of 107

z/OS MVS JCL Introduction


Unit: Coding JOb Statements

Topic: The JOB Statement

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

//JOB1

JOB

504,SMITH

Parameter
Field

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.
Always use a comma to
separate parameters in
a JOB statement.
Concepts

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

Page 8 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Name

Rules for Job Names: A Summary


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.

Valid Job Names


//JOB1 JOB
//EXAMPLE4 JOB
//RUN#2 JOB

Invalid Job Names


//JOB1+ JOB

(Includes a special character)

//EXAMPLE14 JOB (More than eight characters)


// RUN#2 JOB

(Does not begin in position 3)

Special characters or spaces are not


allowed.
Concepts

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

Page 9 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Positional Parameters
The parameter field of a JOB statement appears
after the JOB operator field.
//JOB1 JOB 776,K.YALE
There are two types of parameters:

//JOB2 JOB CLASS=A

Positional
Parameters

Positional parameters
Keyword parameters

What are positional parameters?

Keyword
Parameter

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.

Concepts

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

Page 10 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Coding the Positional Parameter


The two positional parameters for a JOB
statement are:
//JOBNUM1 JOB 776,K.YALE

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.

Concepts

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

Page 11 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Job Accounting Information: Subparameters


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 in
parentheses here.

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

Multiple Parameters

Why?
It appears in parentheses because it consists of
two subparameters:

255
DEPT/OPS

The parentheses indicate to the operating system


that both subparameters comprise the job
accounting information.
Continued
Concepts

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

Page 12 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Job Accounting Information: Subparameters (contd)


Can you use special characters in
subparameters?
//JOB1 JOB(255,DEPT/OPS),K.YALE
Special characters can be used in
subparameters,
provided the subparameters are enclosed in
apostrophes.

Special Character

For example: The subparameter DEPT/OPS


shown is enclosed in apostrophes because the
slash (/) is a special character.

Concepts

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

Page 13 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Omitting Job Accounting Parameter


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.

//JOB1 JOB ,K.YALE


//JOB2 JOB 766,K.YALE

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.

Concepts

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

Page 14 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

The Programmer Name


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

Concepts

//JOB1 JOB 255,JOHN SMITH


//JOB2 JOB ,YALE

Programmer Name

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

Page 15 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Coding Programmer Name


The rules that apply to a programmer's name are
as follows:
Programmer Name Rules

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

255,SMITH,MSGLEVEL=(1,0)
255,LONGPROGRAMERNAME
255,JOHN SMITH

Concepts

Enclose the programmer's name in


apostrophes when, the name contains
special characters (other than periods or
hyphens)

255,OHARA

Double any apostrophes in the


programmer's name

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

Page 16 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Coding Programmer Name Example 1


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

Concepts

//JOB1 JOB 766,JOHN SMITH

Special Character

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

Page 17 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: The JOB Parameter Field

Coding Programmer Name Example 2


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.

//JOB1 JOB 766,OHARA

Name contains an
apostrophe

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.

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

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

Page 18 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

Defining Keyword Parameters


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

Keyword Parameters
ADDRSPC

REGION

CLASS

RD

COND

LINES

GROUP

RESTART

MSGCLASS

SECLABEL

MSGLEVEL

TIME

CARDS

TYPRUN

NOTIFY

USER

PASSWORD

BYTES

PERFORM

PAGES

PRTY

SCHENV

CCSID
Continued
Concepts

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

Page 19 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

Defining Keyword Parameters (contd)


The characteristics of keyword parameters
include :
//JOB1 JOB 255,SMITH,CLASS=A

They must follow any positional


parameter
Keyword

Concepts

They can be coded in any order

They must include a keyword, an equal


sign (=), and a value (for example,
CLASS=A)

Parameter

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

Page 20 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

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:

Concepts

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

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

Page 21 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

Coding the MSGLEVEL Parameter


The MSGLEVEL parameter includes two
subparameters:

Statements
Messages

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


Statement
Message

The syntax for coding the MSGLEVEL parameter


is:

MSGLEVEL=(statements,messages)
Multiple subparameters are enclosed in
parentheses as has been shown here.

Concepts

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

Page 22 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

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:

Concepts

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

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

Page 23 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

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:

Concepts

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

1 Print all allocation/termination messages

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

Page 24 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

The MSGCLASS Parameter


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.

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


//

MSGCLASS=A

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.

Concepts

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

Page 25 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: Keyword Parameters

Defaults for MSGLEVEL & MSGCLASS


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.

//JOB1 JOB 255,MSGCLASS=A


Default: MSGLEVEL=(1,1)
//JOB2 JOB 255,MSGLEVEL=(1,1)
Default: MSGCLASS=A

The MSGLEVEL subparameters are


universal but output class assignments
and the default settings for both
parameters depend on your installation.
Concepts

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

Page 26 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

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

Identify some additional keyword parameters and


explain their purpose

Code the additional parameters

Introduction

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

Page 27 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Keyword Parameters on JOB Statement


There are a host of other keyword parameters
which you can use in your JOB statement.

//JOB1 JOB keyword

You can use them to produce the exact results


you want.
COND
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.

ADDRSPC
CLASS
NOTIFY
PRTY
REGION
TIME
TYPRUN
USER
PASSWORD

Concepts

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

Page 28 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The Operator Subparameter


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.

Concepts

Operator

Meaning

GT

Greater than

GE

Greater than or equal to

EQ

Equal to

NE

Not equal to

LT

Less than

LE

Less than or equal to

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

Page 29 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Reading the COND Parameter: Example 1

//JOB1

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

COND=(12,LT)

//STEP1 EXEC PGM=PROGRAMA


//STEP2 EXEC PGM=PROGRAMB
rn
u
et
R

e
od

Step1

Return
Code < 12

Step2

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

Concepts

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

Page 30 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Reading the COND Parameter: Example 2

//JOB2

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

COND=(12,GT)

//STEP1 EXEC PGM=PROGRAMA


//STEP2 EXEC PGM=PROGRAMB
rn
u
et
R

e
od

Step1

Return
Code > 12

Step2

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

Concepts

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

Page 31 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Reading the COND Parameter: Example 3

//JOB3

JOB 776,SMITH,

//

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

COND=((16,LT),

//STEP1 EXEC PGM=PROGRAMA


//STEP2 EXEC PGM=PROGRAMB

rn
u
et
R

e
od

Step1

(8,GT))
8 < Return
Code < 16

Step2

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

Concepts

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

Page 32 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

COND Parameter on EXEC and JOB Statements

//JOB3

JOB 776,SMITH,

COND=(12,GT)

//STEP1 EXEC PGM=PROGRAMA,


//

COND=(12,GT)

//DD

DD

DSN=INPUT

rn
u
et
R

//STEP2 EXEC PGM=PROGRAMB

e
od

Step1

Return
Code > 12

Step2

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

Concepts

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

Page 33 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The CLASS Parameter


Jobs are site-specific. You can check with your
operations department about the job classes that
are available for your use.

//JOB1

JOB

504,SMITH,CLASS=A

A good balance of job class assignments helps to


make the most efficient use possible of the
system.

Concepts

Job class

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

Page 34 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The NOTIFY Parameter


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

Concepts

JOB

...,NOTIFY=JSMITH

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

Page 35 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The PRTY Parameter


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.

//JOB1

JOB

504,SMITH,PRTY=3
PRTY
Parameter

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.

Concepts

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

Page 36 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Coding CLASS and PRTY Parameters


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.

//JOB1
//

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

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.

Concepts

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

Page 37 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The REGION Parameter


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

JOB
JOB

...,REGION=valueK
...,REGION=valueM
Kilobytes

Megabytes
Continued

Concepts

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

Page 38 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The REGION Parameter (contd)


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:

REGION=512K

//EX
Concepts

JOB

REGION=1M

...,REGION=1M
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 39 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

REGION and ADDRSPC Parameters


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=512K
ADDRSPC=REAL

Concepts

REGION=1M

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

Page 40 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

The TIME Parameter


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

Concepts

JOB

776,STUDENT,TIME=(2,45)

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

Page 41 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

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.

Concepts

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

Page 42 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Coding Multiple Keyword Parameters


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.

//JOB1
//
//
//
//

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

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.

Concepts

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

Page 43 of 107

z/OS MVS JCL Introduction


Unit: Coding JOB Statements

Topic: JOB Statement Parameters

Glossary
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

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

Page 44 of 107

z/OS MVS JCL Introduction

UNIT

Coding EXEC Statements


Topics:
The EXEC Statement
The EXEC Parameter Field
Additional EXEC Parameters
The PARM Parameter
The COND Parameter
The System Library
The STEPLIB DD Statement
Copyright IBM Corp., 2000, 2004. All rights reserved.

Page 45 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements
Unit Objectives
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

Introduction

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

Page 46 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

The EXEC Statement


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.

Procedure

A procedure may contain one or more EXEC


statements.
Continued
Concepts

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

Page 47 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

The EXEC Statement (contd)

Identifier

Name

Operation

Parameter

Comment

In Unit 2 Coding JOB Statements you learnt that the JOB statement has a particular coding syntax.
Similarly, the EXEC statement too has to be coded using a particular JCL syntax. Like the JOB
statement, the EXEC statement too has five fields. The EXEC statement format includes the following:

Identifier Field (//): It occupies position 1 and 2


Name Field: It names the step starting in position 3
EXEC Operator Field: It states the JCL statement type
Parameter Field: It is used to state the parameters used on an EXEC statement
Comment Field: This field is optional
Continued

Concepts

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

Page 48 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

The EXEC Statement (contd)


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?

Operator
//STEP1 EXEC PGM=IEBUPDTE
Step
Name

Positional
Parameter

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.

Code a step name on all your EXEC statements


even if there might not be any references to
those statements.
Concepts

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

Page 49 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

The Step Name


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

Valid Step Names


//STEP1 EXEC
//EXAMPLE4 EXEC
//RUN#2 EXEC

Invalid Step Names


//STEP1+ EXEC

(Includes a special character)

//EXAMPLE14 EXEC (More than eight characters)


// RUN#2 EXEC

(Does not begin in position 3)

Continued
Concepts

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

Page 50 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

The Step Name (contd)


Shown here are two step names STEP#FOUR
and LA$JOE.
Are both the names valid step names?

//STEP#FOUR EXEC PGM=IEFBR14


//LA$JOE EXEC PGM=IEGENER

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.

Concepts

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

Page 51 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Statement

Glossary
Procedure

Glossary

Prepared sets of job control statements cataloged in a procedure library

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

Page 52 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Parameter Field

The Positional Parameter


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

Concepts

//STEP1 EXEC procedure-name


//STEP2 EXEC PROC=procedure
//STEP1 EXEC PGM=program-name
Positional
Parameter

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

Page 53 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Parameter Field

The PGM= Positional Parameter

//JOB1

JOB

3SPO3W,CLASS=B

//STEP1 EXEC PGM=PAYROLL

Program

Payroll

What does PGM= designate?


PGM= designates a program the system executes during the job step. Shown here is the syntax of PGM as a
positional parameter in the EXEC statement.
Concepts

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

Page 54 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Parameter Field

The PROC= Positional Parameter

//LA$JOE JOB
//STEP1

3SPO3W,CLASS=B

EXEC PROC=MYPROC

Procedure

What does PROC= designate?


PROC= designates a procedure the system executes. The syntax of PROC as a positional parameter in an
EXEC statement is shown here.
Concepts

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

Page 55 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Parameter Field

Omitting the PROC= Keyword


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.

//STEP3 EXEC procedure-name

//STEP3 EXEC MYPROC

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.

Concepts

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

Page 56 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The EXEC Parameter Field

Positional Parameter Coding Errors


JCL errors occur if you, as a JCL programmer fail
to follow any of the coding rules regarding the
PGM and PROC positional parameters.

//LA$JOE JOB
//STEP1

3SPO3W,CLASS=B

EXEC PGR=IEFBR14

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


the EXEC statement shown here returns a JCL
error.

Continued
Concepts

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

Page 57 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: Additional EXEC Parameters

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

Concepts

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

Page 58 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: Additional EXEC Parameters

Keyword Parameters
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:

PGM=PROGA,keyword
ACCT
RD
DYNAMNBR
ADDRSPC
PERFORM
REGION
PARM
COND

The PARM parameter


The COND parameter

TIME
DPRTY
CCSID

Concepts

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

Page 59 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The PARM Parameter

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)

Concepts

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

Page 60 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The PARM Parameter

Rules for Coding the PARM Parameter


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

Concepts

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

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

Page 61 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The PARM Parameter

Coding the PARM Parameter Example 1

//JOB1

JOB

766,SMITH

PARM=MONTHLY

//RUN#2 EXEC PGM=REPORT,


//

PARM=MONTHLY

PARM
Parameter

REPORT

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

Concepts

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

Page 62 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The PARM Parameter

Coding the PARM Parameter Example 2

//JOB1

JOB

766,SMITH

PARM=10-31-98

//RUN#2 EXEC PGM=REPORT,


//

PARM=10-31-98

PARM
Parameter

REPORT

This EXEC statement passes the date (10-31-98) as input to the program called REPORT. The subparameter
is enclosed in apostrophes because special characters are used.

Concepts

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

Page 63 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The PARM Parameter

Coding the PARM Parameter Example 3

//JOB1

JOB

766,SMITH

PARM=(MONTHLY,
10-31-98)

//RUN#2 EXEC PGM=REPORT,


//

PARM=(MONTHLY,10-31-98)

PARM
Parameter

REPORT

In this example, the EXEC statement passes both the type of report (MONTHLY) and the date (10-31-98) as
subparameters of the PARM parameter. The two subparameters are enclosed in parentheses.

Concepts

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

Page 64 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

Topic Objectives
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

Introduction

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

Page 65 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

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

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

Page 66 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

COND Parameter Operators


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.

Concepts

Operator

Meaning

GT

Greater than

GE

Greater than or equal to

EQ

Equal to

NE

Not equal to

LT

Less than

LE

Less than or equal to

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

Page 67 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

COND Parameter An Example


COND=(8,GT)
//JOB1

JOB

778,SMITH

//EXAMPLE2 EXEC

PGM=DELETE

//EXAMPLE3 EXEC

PGM=UPDATE,

//

COND=(8,GT)

//DD1

DD

DSN=INPUT

DELETE

In the example shown here, the COND parameter reads as follows:


"If the return code from any previous step is less than 8, then bypass this step."
Continued
Concepts

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

Page 68 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

COND Parameter An Example (contd)

//JOB1

JOB

COND=(8,GT,
STEP1)

778,SMITH

//EXAMPLE2 EXEC

PGM=DELETE

//EXAMPLE3 EXEC

PGM=UPDATE,

//

COND=(8,GT,EXAMPLE2)

//DD1

DD

DSN=INPUT

DELETE

The COND parameter in the step EXAMPLE3, includes a stepname subparameter. This causes the COND
statement to read as follows:
"If the return code from step EXAMPLE2 is less than 8, then bypass step EXAMPLE3."
Concepts

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

Page 69 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

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

If you code COND=EVEN on an EXEC statement as shown here, the program STEP4 always executes, even
if a previous step (e.g. STEP3) in the job terminates abnormally.

Concepts

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

Page 70 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

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

If you code COND=ONLY on an EXEC statement as shown here, the program STEP4 will execute only if a
previous step in the job terminates abnormally.

Concepts

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

Page 71 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The COND Parameter

Using the EVEN & ONLY Subparameters


The EVEN and ONLY subparameters cannot
appear on the same step. They are mutually
exclusive.

//ST4 EXEC PGM=PROG7,


//

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.

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

//ST4 EXEC PGM=PROG7,


//

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

For example, the two EXEC statements shown


here mean the same thing.
If a job step terminates abnormally, the system
bypasses all subsequent steps unless they have
been coded with an EVEN or ONLY
subparameters on the COND parameter.

Concepts

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

Page 72 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The System Library

Private Program Libraries


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.

//JOB1

JOB

//JOBLIB DD
//

776,SMITH
DSN=LIBRARY,

DISP=SHR

//STEP1 EXEC PGM=MYPROG

The JOBLIB DD statement causes the system to


search a private library before searching
SYS1.LINKLIB.
If you want the system to call a program from a
private library you should insert the JOBLIB DD
statement in the job before the first EXEC
statement in the job.

Concepts

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

Page 73 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The STEPLIB DD Statement

Topic Objectives
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

Introduction

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

Page 74 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The STEPLIB DD Statement

The STEPLIB DD Statement


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.

//STEP1 EXEC PGM=PROGA


//STEPLIB DD DSN=MYLIB,DISP=SHR

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.

Concepts

The STEPLIB DD statement can be


placed anywhere in a job step but it
typically appears after an EXEC
statement.

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

Page 75 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The STEPLIB DD Statement

Comparison between JOBLIB and STEPLIB DD Statements


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.

//JOB1

JOB

777,SMITH

//STEP1

EXEC PGM=PROGA

//STEP2

EXEC PGM=MYPROG

//STEPLIB

DD

//

DISP=SHR

//STEP3

EXEC PGM=PROGB

DSN=LIBRARY,

Continued
Concepts

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

Page 76 of 107

z/OS MVS JCL Introduction


Unit: Coding EXEC Statements

Topic: The STEPLIB DD Statement

Comparison between JOBLIB and STEPLIB DD Statements (contd)


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.

//JOB1

JOB

777,SMITH

//JOBLIB

DD

DSN=USER1

//STEP1

EXEC PGM=MYPROG

//STEPLIB

DD

//

DISP=SHR

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

Concepts

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

Page 77 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Topic Objectives
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

Introduction

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

Page 78 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

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

IF (relational-expression) THEN
JCL statement(s) to be executed when relational-expression is true
ELSE
JCL statement(s) to be executed when relational-expression is false
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

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

Page 79 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Name Field


What are the rules for valid name fields?
Even though the name field is optional, if one is
coded then it must follow the normal coding rules
for names in JCL statements, such as:

Concepts

Valid JCL Names


//CHECK1 IF (relational-expression) THEN
//UNIQUE IF (relational-expression) THEN

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

// CHECK1

The remaining characters can be


alphanumeric or national

//CHECK#2IF

The name field must be followed by at


least one space

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

Invalid JCL Names


(Does not begin in position 3)

//TOOMANYCHARS (More than eight characters)


(Needs blank space after name)

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

Page 80 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Operation Field The IF Statement


Identifier

Name

Operation

Relational-Expression

Field

Field

Field

Field

Comment
Identifier

// UNIQUE NAME IF RELATIONAL-EXPRESSION THEN

Field

COMMENT

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


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

Concepts

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

Page 81 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Operation Field The ELSE Statement


Identifier

Name

Operation

Comment

Field

Field

Field

Field

//

UNIQUE NAME

ELSE

COMMENT

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


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.

Concepts

Concepts

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

Page 82 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Operation Field The ENDIF Statement


Identifier

Name

Operation

Comment

Field

Field

Field

Field

//

UNIQUE NAME

ENDIF

COMMENT

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.

Concepts

Concepts

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

Page 83 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Relational-Expression Field


What is the relational-expression field?
The relational-expression field follows the IF
statement and specifies the condition that is
evaluated at execution.

//TESTRC IF RC<8 THEN

Relational-Expression
Field

Depending on the values in the expression, the


result of the condition is either true or false.
//TESTRC IF (RC<8) THEN
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.
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.
Concepts

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

Page 84 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The Relational-Expression Field (contd)


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.

//TESTRC IF (ABEND | RC<8 |


// RC=16) THEN
Comment
goes here

Comments cannot be placed on the line you


are continuing as the system will try to evaluate
the comments as part of the expression.
Concepts

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

Page 85 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Comparison Operators
What are the characteristics of a Comparison
Operator?
Comparison operators compare a relationalexpression keyword to a numeric value. The
result of the comparison is either true or false.
The comparison operators are either alphabetic
or
arithmetic.

Concepts

Operator

Meaning

GT or >

Greater than

GE or >=

Greater than or equal to

NG or >

Not greater than

EQ or =

Equal to

NE or =

Not equal to

LT or <

Less than

LE or <=

Less than or equal to

NL or <

Not less than

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

Page 86 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Comparison Operators An Example


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.

//TESTIT IF (RC=8) THEN


Spaces are
not required
//TESTIT IF RC EQ 8 THEN
Spaces are
required

The use of parentheses in the relationalexpression is optional, but it is useful when


coding combinations of expressions.
Concepts

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

Page 87 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Logical Operators- AND


What are the characteristics of the AND
operator?
The AND (&) operator returns a value only if both
relational-expressions are true.

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


THEN

RC = 12

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


and 24:

The
condition
is true

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

The AND operator must be preceded


and followed by at least one space.
Concepts

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

Page 88 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Logical Operators- OR
What are the characteristics of the OR
operator?
The OR (|) operator returns a true value if either
of
the relational-expression is true.

IF (RC>8 | RC<16)
THEN

RC = 12

For example, to test if a return code is either


equal to 8 or 16:

The
condition
is false

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

The OR operator must be preceded and


followed by at least one space.
Concepts

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

Page 89 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Logical Operators- NOT


What are the characteristics of the NOT
operator?

IF (RC>12) THEN

The NOT () operator reverses the testing of a


relational-expression. The system evaluates the
NOT operator before any comparisons or logical
operators.

RC = 8

The
condition
is true

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


to 12:

//TEST3 IF (RC=12) THEN

The NOT operator does not require a space to


separate it from the expression it is reversing.
Concepts

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

Page 90 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

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:

Concepts

stepname.procstepname.keyword

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

Page 91 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Relational-Expression Keywords - RC
What are the characteristics of the RC
keyword?
RC represents the highest return code received
from a previous job step.

//TESTRC IF (RC>4) THEN


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

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.

Concepts

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

Page 92 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Relational-Expression Keywords - ABEND


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:

//TEST IF ABEND THEN


//TEST IF TEST1.ABEND = TRUE THEN

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

Both formats can be preceded with a step name or


procedure step name to check specific job steps or
procedure steps for abnormal termination.
Concepts

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

Page 93 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

Relational-Expression Keywords - ABENDCC

ABENDCC = Sxxx

ABENDCC = Uxxxx
U = Abnormal userdefined completion code

S = Abnormal system
completion code

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.

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

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

Page 94 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

ABENDCC An Example
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.

Concepts

//TST4ABND IF ABENDCC = S0C1 THEN

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

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

Page 95 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: IF/THEN/ELSE/ENDIF Construct

The ELSE Clause An Example


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

//TESTRUN
//GOOD
// ELSE
//ERROR
// ENDIF
//STEP2

IF STEP1.RUN THEN
EXEC PGM=CREATE
EXEC PGM=DELFILES
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

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

Page 96 of 107

z/OS MVS JCL Introduction


Unit: Conditional Processing

Topic: Nesting Conditional Constructs

Nesting Conditional Constructs


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.

//COMPPGM
//CHKCOMP
//LNKPGM
//CHKLKED
//DELPGM
// ELSE
//RUNPGM
// ENDIF
// ENDIF
//COMPLIB

EXEC PGM=COMPILE
IF (COMPPGM.RC<=4) THEN
EXEC PGM=LINK
IF (LNKPGM.RC>4) THEN
EXEC PGM=DELETE
EXEC PGM=MYPROG
EXEC PGM=COMPRESS

The example shows a nested conditional


construct where the value of return code of a
program determines the next step.

Concepts

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

Page 97 of 107

z/OS MVS JCL Introduction


Unit: Using Special DD Statements
Unit Introduction
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.

Introduction

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

Page 98 of 107

z/OS MVS JCL Introduction


Unit: Using Special DD Statements
Unit Objectives
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

Introduction

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

Page 99 of 107

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

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

DD PARAMETERS
PGM

VOL

DSN

DCB

How does this technique help?


Backward reference technique is more efficient
as
it saves the programmer from repetitive coding of
information.

Concepts

Page 100 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

Types of Backward References


Four common backward references are:

Concepts

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

Page 101 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

Syntax for Backward Reference


The general form of a backward reference is as
follows:
keyword=*.ddname

To refer back to a prior DD statement


within the same job step:

keyword=*.stepname.ddname

Keyword=*.ddname

//JOB1

To refer back to a DD statement in a


prior job step:

//STEP1 EXEC

Keyword=*.stepname.ddname

or

//DD1
//DD2
//DD3

DD DSN=ABC
DD DSN=...
DD DSN=*.DD1

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

Page 102 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

Syntax for PGM Backward Reference

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

//STEP

Concepts

EXEC PGM=*.stepname.ddname

Page 103 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

PGM Backward Reference Example 1

A PGM backward reference is often used following a linkage edit step, in which a load module (program) is
stored 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.

Concepts

Page 104 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

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.

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

STEPA executes the program, using a PGM


backward reference.

Concepts

Page 105 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

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 weeks transactions.
This requires that, each week the data set name
must be changed in the order WEEK1, WEEK2
and so on.

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

By using a DSN backward reference, the data set


can be retrieved each week by changing only one
DD statement, DD1.

Continued
Concepts

Page 106 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

VOL Backward Reference Example 1


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

Concepts

PGM=PROGA
DSN=XYZ,
DISP=(NEW,CATLG),
VOL=REF=ABC

Page 107 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

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

Concepts

//STEPA
//DD2
//
//DD1
//
//

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

Page 108 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

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.

Concepts

//STEP1
//DD1
//
//
//STEP2
//DD2

EXEC
DD
EXEC
DD

PGM=PROG1
DCB=(RECFM=FB,
LRECL=80,
BLKSIZE=800)...
PGM=PROG2
DCB=*STEP1.DD1,...

Page 109 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Using Backward Reference

DCB Backward Reference Overriding


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.

Continued
Concepts

Page 110 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Concatenating Data Sets

Data Set Concatenation An Example


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.

Concepts

Page 111 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Concatenating Data Sets

JCL for Data Set Concatenation An Example


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.

Concepts

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

Page 112 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Dummy Data Sets

Overview
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
programs processing or when an output data set
is not required dummy data sets can be used.

Concepts

Page 113 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Dummy Data Sets

Specifying Dummy Data Sets


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

NULLFILE is a reserved word and a data


set cannot be named as NULLFILE.
Concepts

Page 114 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Dummy Data Sets

Dummy Data Sets An Example


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

EXEC
DD
DD

PGM=PAY
----.
.
.

Continued
Concepts

Page 115 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Dummy Data Sets

Dummy Data Sets An Example (contd)


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

EXEC
DD
DD

PGM=PAY
---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.

Concepts

Page 116 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Storage Dumps

Storage Dumps
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:

Concepts

They are difficult to read since they are


printed in hexadecimal code

Printing storage dumps is time


consuming

Page 117 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Storage Dumps

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

Concepts

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.

Page 118 of 107

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

z/OS MVS JCL Introduction


Unit: Using Special DD Statements

Topic: Storage Dumps

Handling Storage Dumps


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.

//STEP1
//SYSDUMP
//DD1
//STEP2
//SYSDUMP

EXEC
DD
DD
EXEC
DD

PGM=PROG1
SYSOUT=X
...
PGM=PROG2
SYSOUT=X

The example shown uses SYSUDUMP DD statement.


If STEP1 or STEP2 terminates abnormally, the
system creates a dump of the program storage area.

Concepts

Page 119 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters
Unit Objectives
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

Introduction

Page 120 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Identifying Analysis Criteria


A procedure listing is obtained and examined to
ensure that it meets the following two criteria:

Concepts

The procedure invokes the proper


programs in the desired sequence

Most of the DD statements are usable


without major alteration

Page 121 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Identifying Analysis Criteria - An Example


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.

Continued
Concepts

Page 122 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Identifying Analysis Criteria - An Example (contd)


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

Continued
Concepts

Page 123 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Identifying Analysis Criteria - An Example (contd)


Shown on the right is the procedure named
TRANSACT that is used to accomplish this task.
A procedure listing is obtained to determine:

Concepts

If it uses the required programs in the


required sequence

If it uses appropriate data sets

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

Page 124 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Analysis Explanation
The listing for the procedure TRANSACT
indicates 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 DD


statement)

A temporary data set named &&VALID


that is passed to PROG2 (DD4 DD
statement)

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

Continued
Concepts

Page 125 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Analyzing Procedures

Analysis Explanation (contd)


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.

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

Continued
Concepts

Page 126 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Changing EXEC Parameters

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

Continued
Concepts

Page 127 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Changing EXEC Parameters

Coding Changes (contd)


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:

Concepts

Override the parameters on the


procedure EXEC statement

//STEP1 EXEC

//DD1

DD

parameter

//DD2

DD

parameter

Override
Nullify

Nullify parameters on the procedure


EXEC statement
Add parameters to the procedure EXEC
statement

procedure name,parameter

Add
New DD
Statement

Page 128 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Override Statements

Overriding Statement Parameters


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.

//PSTEP1
//DD1
//DD2
//DD3
//DD4
//
//
//
//PSTEP2
//DD5
//
//DD6

EXEC
DD
DD
DD
DD

EXEC
DD

PGM=PROG1,TIME=(1,30)
DSN=INTRAN,DISP=SHR
DSN=MASTER,DISP=SHR
SYSOUT=A
DSN=&&VALID,
DISP=(NEW,PASS),
UNIT=SYSDA,
SPACE=(TRK,(1,1))
PGM=PROG2,TIME=5
DSN=&&VALID,
DISP=(OLD,DELETE)
DD SYSOUT=A

Continued
Concepts

Page 129 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Override Statements

Overriding Statement Parameters (contd)


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.

Concepts

//PSTEP1
//DD1
//DD2
//DD3
//DD4
//
//
//
//PSTEP2
//DD5
//
//DD6

EXEC
DD
DD
DD
DD

EXEC
DD

PGM=PROG1,TIME=3
DSN=INTRAN,DISP=SHR
DSN=MASTER,DISP=SHR
SYSOUT=A
DSN=&&VALID,
DISP=(NEW,PASS),
UNIT=SYSDA,
SPACE=(TRK,(1,1))
PGM=PROG2,TIME=5
DSN=&&VALID,
DISP=(OLD,DELETE)
DD SYSOUT=A

Page 130 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Addition Statements

Adding Parameters to a Procedure


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
Addition

Continued
Concepts

Page 131 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Addition Statements

Adding Parameters to a Procedure (contd)


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.

Concepts

//PSTEP1
//
//DD1
//DD2
//DD3
//DD4
//
//
//
//PSTEP2
//
//DD5
//
//DD6

EXEC
DD
DD
DD
DD

EXEC
DD
DD

PGM=PROG1,TIME=(1,30)
PARM=01/29/91
DSN=INTRAN,DISP=SHR
DSN=MASTER,DISP=SHR
SYSOUT=A
DSN=&&VALID,
DISP=(NEW,PASS),
UNIT=SYSDA,
SPACE=(TRK,(1,1))
PGM=PROG2,TIME=5
PARM=01/29/91
DSN=&&VALID,
DISP=(OLD,DELETE)
SYSOUT=A

Page 132 of 107

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

z/OS MVS JCL Introduction


Unit: Modifying EXEC Parameters

Topic: Sequencing Multiple Changes

Sequencing Multiple Changes An Example


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

//JSTEP EXEC TRANSACT,TIME.PSTEP1=3,


//
PARM.PSTEP1=01/29/99,
//
TIME.PSTEP2=,
//
PARM.PSTEP2=01/29/99

The JCL statements on the right show how to


combine these alterations on the EXEC statement
that invokes the procedure.

Concepts

Page 133 of 107

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

Das könnte Ihnen auch gefallen