Вы находитесь на странице: 1из 20

Instruction, Research & Infrastructure Support, Arizona State University

IBM Mainframe July 2002

Introduction to JCL

Table of Contents

1. INTRODUCTION .................................................................................................1
2. WHAT IS JCL? ......................................................................................................1
2.1 Example Job .............................................................................................1
2.2 JCL Statements.........................................................................................2
2.3 JES2 Statements........................................................................................2
3. INITIATING A BATCH JOB................................................................................3
3.1 Identifying Yourself ................................................................................3
3.2 Job Resource Specification ......................................................................4
3.3 Coding the Keyword Parameters...........................................................4
3.4 Job Priority ...............................................................................................5
4. CONTROLLING A JOB WITH JES2 ...................................................................6
4.1 Controlling the Amount of Output........................................................6
4.2 Controlling the Location of Your Output..............................................6
5. SPECIFYING THE JOB STEPS.............................................................................6
5.1 Executing a Cataloged Procedure ..........................................................7
5.2 Executing a Program Directly ................................................................8
6. DEFINING THE DATA SETS..............................................................................9
6.1 Reading from the Input Data Stream (Card Images) ...........................9
6.2 Reading from Existing Disk or Tape Data Sets.....................................10
6.3 Writing to the Printer ..............................................................................11
6.4 Creating New Disk or Tape Data Sets ...................................................11
6.4.1 Sequential Disk Data Sets.........................................................12
6.4.2 Partitioned Disk Data Set .........................................................12
6.4.3 Tape Data Sets ...........................................................................13
6.5 Adding to an Existing Disk Data Set .....................................................14
7. ADDING COMMENTS........................................................................................15
8. TERMINATING A JOB ........................................................................................16
9. INTERPRETING YOUR PRINTED OUTPUT ....................................................16
Appendix A - JCL Syntax Rules ..............................................................................17
Appendix B - JES2 Syntax Rules..............................................................................18
Appendix C - Rules for Data Set Names ................................................................18

MVS -i- JCL


Instruction, Research & Infrastructure Support, Arizona State University

IBM Mainframe July 2002

Introduction to JCL

1. INTRODUCTION

This write-up provides information necessary to create a simple IBM batch job. These
jobs are submitted via TSO. The JCL statements used for card images are shown.

2. WHAT IS JCL?

All large computer systems are controlled by a special set of programs that schedule the
incoming jobs and allocate time and other resources to jobs that are running. On the
IBM system, these programs are called the Operating System.

If you want to submit a job to the computer, you must communicate with this set of
supervisory programs, telling it who you are, what program you want to run, and how
much time and other resources you need. To do this, you communicate with the IBM
Operating System using Job Control Language (JCL).

IBM JCL has been in existence since the mid-60's and, over the years, has been used to
communicate with several different versions of the operating system. ASU, we is
currently using a version of the operating system called OS/390, also known as MVS.
The Job Entry Subsystem (JES2) is part of MVS which controls batch job submission and
printing. JES2 has a few control statements used in addition to the regular JCL
statements.

2.1 Example Job

Here is an example of a simple batch job that lists a sequential disk data set (file) on a
printer at the Computing Commons Site.

{1} //jobname JOB (acctnum),'your name',


// TIME=(minutes,seconds),REGION=8M,
// NOTIFY=userid
{2} /*ROUTE PRINT UCC1
{3} //*
//* IBM EXAMPLE
//*
{4} //STEP1 EXEC IEBGENER
{5} //SYSUT1 DD DSN=data.set.name,DISP=SHR
{6} //SYSUT2 DD SYSOUT=A
{7} //

MVS -1- JCL


Introduction to JCL

The items in lower case vary for each individual user. The numbers in {} identify the
purpose of the various statements, as follows:

{1} identifies the job, account number, time required, etc.


{2} directs the printed output to the Computing Commons Site.
{3} are comments.
{4} executes the utility procedure, IEBGENER.
{5} identifies a cataloged data set as input.
{6} identifies the printer as the output data set.
{7} marks the end of the job.

2.2 JCL Statements

In general, a JCL statement looks like this:

//name operator operand comments

The JCL operators (JOB, EXEC, DD) do not immediately follow the "//" but are toward
the middle of the JCL statement. Note that they are preceded and followed by one or
more blanks.

The operand field consists of one or more parameters separated by commas.

Care must be exercised when long JCL statements are continued onto the next line.
Although JCL statements must not be coded beyond column 71, the operand field may
be continued on another line by ending the first line at a comma and beginning the next
line with "// " (two slashes and a blank). The first parameter on the continued line
must begin between column 4 and column 16, inclusive. If it begins in column 17 or
later, the line will be treated as a comment. The JOB statement in the above example job
takes two lines.

There are nine JCL statements, but only six of these are commonly used in simple jobs.
These six JCL statements are described in this write-up:

// JOB The job statement


// EXEC The execute statement
// DD The data definition statement
//* The comment statement
/* The delimiter statement
// The null statement (end of job)

2.3 JES2 Statements

JES2 statements have a different format than JCL statements. In general, JES2
statements look like this:

MVS -2- JCL


Introduction to JCL

/*operator parameters

Unlike JCL, there is no name field and therefore no blank between "/*" and the
operator.

These JES2 statements are commonly used on our system:

/*JOBPARM The job parameter statement


/*ROUTE The output route statement
/*TAPE The tape statement

For a complete summary of IBM JCL and JES2 coding rules, see the appendices.

3. INITIATING A BATCH JOB

3.1 Identifying Yourself

With your IBM computer account, you are given an account number, a userid, and a
system access password. These are used to identify you as a valid computer user.

When submitting a batch job, the first thing you must do is identify yourself. This is
done with the JOB statement given below. Code all the punctuation marks and blank
spaces as shown. Lowercase letters are not permitted except within a quoted string or
in comments.

//jobname JOB (acctnum,room),'your name',


// TIME=(minutes,seconds),REGION=nM,
// PASSWORD=password,
// NOTIFY=userid

• The jobname has a maximum of 8 characters. The first 5 must be your userid; the
last 3 characters are optional letters and/or digits. The computing site operators use
the last alphabetic character of the jobname to file your output.
• Your five-character account number (acctnum) follows the word JOB.
• The optional room code is used only for delivery of plotted output to academic
computing sites. The ROUTE statement controls where printed output is produced
(see section 4.3).
• Your name or other identification (up to 20 characters), is enclosed in single quotes.
This parameter is optional.
• Keyword parameters (TIME and REGION) are used to provide the computer with
information about the job itself. They are described in the following sections.
• The PASSWORD parameter is usually omitted. It is needed if you are submitting a
batch job from a non-TSO environment or are submitting the batch job for a userid
different from the one with which you logged onto TSO.
• The NOTIFY parameter displays a message on the terminal screen of the indicated
userid when the batch job completes execution.

MVS -3- JCL


Introduction to JCL

3.2 Job Resource Specification

A batch job may have its resources specified in two ways:

• by default
• by explicit values for each resource.

The following resource are available, where K=1000 lines when referring to print,
K=1024 bytes when referring to memory, and M=1024K (1024*1024 or 1048576) bytes
when referring to memory.

CPU Time Memory Printed Lines Tape Drives


Default 5 seconds 8M 10K 0
Maximum 6 hours 64M 120K 4

The time parameter is as follows, where "minutes" is 0-360 minutes and "seconds" is 0-
59 seconds:

TIME=(minutes,seconds)

For tape drives use the JES2 statement as follows, where "n" may be 0, 1, 2, 3, or 4:

/*TAPES n

The memory parameter is as follows, where "m" is the number of megabytes (M) of
memory and "n" is the number of kilobytes (K) of memory:

REGION=mM
or
REGION=nK

3.3 Coding the Keyword Parameters

Usually the JOB parameters (such as userid and account number) that identify you as a
valid user stay the same from job to job. The keyword parameters that specify job
resources may change with each job. TIME, and REGION are specified as defined
below:

• "TIME=(minutes,seconds)" requests computer (CPU) time. If TIME is expressed


in minutes only, the parentheses may be omitted, e.g., "TIME=2" for two
minutes. If TIME is expressed in seconds only, use both parentheses and the
leading comma, e.g., "TIME=(,5)" for 5 seconds. Seconds must be less than 60.
• "REGION=nM" controls the amount of memory available to the job.

MVS -4- JCL


Introduction to JCL

Other JOB parameters are described in the IBM JCL Guide. Please see a consultant if
you have any questions.

The following are some typical JOB statements:

//jobname JOB (acctnum,UCC1),'JOE STUDENT',


// TIME=(,5),REGION=8M,
// NOTIFY=userid

The above is a common JOB statement recommended for small jobs.

//jobname JOB (acctnum,BUS1),JONES,


// TIME=1,REGION=4M,
// NOTIFY=userid

This JOB statement shows some possible variations. This job may run up to 1 minute.
Because there are no blanks or special characters in the programmer's name, the single
quotes are omitted.

//jobname JOB (acctnum),'J. SMITH',


// TIME=(1,30),REGION=32M,
// NOTIFY=userid
/*TAPES 2

The above JCL is for a job that uses up to two tape drives. The time requested is one
minute and 30 seconds. Remember, TIME=(,90) is not allowed. The amount of memory
requested is 32 megabytes.

3.4 Job Priority

The priority with which jobs are scheduled to begin execution is largely determined by
the computing resource requested. Jobs requiring fewer computing resources have
higher priority than jobs requiring large amounts of resources. The setting of actual job
priorities is handled automatically by the operating system.

Note: A job's turnaround time (time from submittal to end of execution) is effected by
the amount of resources used by the job. Thus, a given job may still be executing even
though some jobs that started later have completed.

For most jobs the amount of CPU time requested when the job is submitted determines
the starting priority. After the job is in the queue for some period of time without being
selected for execution, its priority is increased. (The process of increasing the priority
after successive set periods of time is called aging. The aging continues until the job's
maximum priority value is reached or the job starts execution.)

MVS -5- JCL


Introduction to JCL

4. CONTROLLING A JOB WITH JES2

JES2 control statements are placed after the JOB statement. They are tell the system how
much output you are expecting and where you want it printed. If these statements are
not present, default values are used.

4.1 Controlling the Amount of Output

The JOBPARM statement gives you some control over the printed output for the entire
job.

/*JOBPARM LINES=nn

This statement specifies the maximum number of output lines for the entire job in
thousands of lines. The default value is "LINES=10" for 10,000 lines. If a job needs more
than the default, include a JOBPARM statement with the LINES parameter and an
appropriate value. The following requests 20,000 lines.

/*JOBPARM LINES=20

4.2 Controlling the Location of Your Output

The ROUTE statement directs all the printed output for a job to a particular printer.

/*ROUTE PRINT routecode

The following printers are available:

Printer Route codes


ASU West WEST1
Business East BUS3
Computing Commons UCC1
WYLBUR Fetch WYLBUR
TSO Keep KEEP

The route codes WYLBUR and KEEP are for non-existent printers. Output directed to
these printers are retained in queue without printing. This permits the output to
viewed on the screen during an interactive TSO session, and then either purged or
printed. (TSO has additional mechanisms for retaining printed output.)

5. SPECIFYING THE JOB STEPS

The various JCL statements that go together to define one action are called a job step. A
job step begins with a required EXEC statement to tell the computer what to execute. It

MVS -6- JCL


Introduction to JCL

is usually followed by one or more DD statements that tell what data sets to use. This
section describes the EXEC statement and shows how the DD statements are placed in
relation to it. For details on the DD parameters, see the next section.

5.1 Executing a Cataloged Procedure

Most job steps require several JCL statements. Common tasks like compiling and
executing a FORTRAN program require two or three steps, each one using several data
sets. However, these commonly used groups of JCL statements are stored in a system
file called the Procedure Library (SYS1.PROCLIB). When you call these cataloged
procedures (or procs) with your EXEC statement, most of the JCL statements needed
for the job step are included in your job. Then, all you need to do is add the specific DD
statements that are needed for your individual application.

There are procedures for statistical packages, compilers, data set utilities, and other
standard programs. (A variety of locally produced documentation is available which
describes these packages.) The format for the EXEC statement is:

//stepname EXEC procname,optional -parameters

The step name is optional but highly recommended, especially if the job has more than
one step. The step name is used in error messages and helps to identify any errors. If it
is omitted, there must be at least one space between "//" and "EXEC".

The proc name must be coded exactly as given in the write-up for each application. For
the language procs, the last 1, 2 or 3 letters of the proc name identify the action taken by
the procedure. For example, "FORV2CG" is the compile-and-go procedure (note the last
two letters) for the FORTRAN compiler and loader (G for GO). This procedure contains
two steps, often called proc steps. The proc step names are "FORT" and "GO".

The following example illustrates a complete one-step job to compile and execute a
FORTRAN program with card-image input.

//jobname JOB (acct,UCC1),'your name',


// TIME=(,5),REGION=8M,
// NOTIFY=userid
/*ROUTE PRINT UCC1
/*JOBPARM LINES=12
//FIRST EXEC FORV2CG
//FORT.SYSIN DD *
(FORTRAN program)
/*
//GO.SYSIN DD *
(data)
/*
//

MVS -7- JCL


Introduction to JCL

When the job step executes a procedure with two or more proc steps, the ddnames are
written in two parts:

//procstepname.ddname DD etc.

Therefore, "FORT.SYSIN" is input to the first step of the procedure, and "GO.SYSIN" is
input to the second step.

The optional parameters most frequently used on the EXEC statement are symbolic
parameters defined inside the procedures. They are different for each procedure.

5.2 Executing a Program Directly

Sometimes there is no ready-made procedure. To execute a program directly (either a


utility program or a user-written program) the format is

//stepname EXEC PGM=programname

The program must be in the form of a load module (executable code) and a member of
a partitioned data set. Only the module name is used here. By default, the module is
assumed to be in the file SYS1.LINKLIB, where the IBM utility programs are stored. For
example,

//STEP1 EXEC PGM=IEFBR14

executes one of the IBM utilities stored in SYS1.LINKLIB.

For programs in another library, that data set name must be given on a separate
STEPLIB or JOBLIB DD statement. For example, either

//STEP1 EXEC PGM=PROG1


//STEPLIB DD DSN=...
//SYSIN DD ...
or
//JOBLIB DD DSN=...
//STEP1 EXEC PGM=PROG1
//SYSIN DD ...

executes a user written program with the name PROG1. Note that the JOBLIB DD
statement precedes the EXEC statement. This library is used for all the steps in the job.
If the program is not found, then the system library, SYS1.LINKLIB, is also searched.
The STEPLIB library, on the other hand, is used only for this job step. The DD
statements for any data sets required by the program follow the EXEC statement as
before.

MVS -8- JCL


Introduction to JCL

6. DEFINING THE DATA SETS

A job step usually contains one or more Data Definition or DD statements. The data
defined by these statements occur in groups called data sets (sometimes called files).
There must be one DD statement for each data set used by the program including all
necessary work data sets and printed output data sets, as well as your regular files.
However, many of these are included in the cataloged procedures and do not need to
be coded again.

Because the DD statement must describe so many different types of data, it has a large
number of possible parameters. Only the most common ones will be discussed here.
Others are described in the IBM JCL Job Control Language Guide.

The general format of the DD statement is:

//ddname DD parameters

The required ddname is the link between the data and the program. Because of this
link, you will often be told what ddnames to use for a particular program.

6.1 Reading from the Input Data Stream (Card Images)

The input data stream refers to program or data lines that immediately follow their DD
statement. This data is called card-image data because it is restricted to 80 characters
per line (the size of a punched card). For plain data (no JCL or JES2) use:

//ddname DD *
(data lines)
/*

• The ddname for card image input is often SYSIN, but you can have multiple input
data streams in one step with different ddnames.
• "/*" (the delimiter statement) marks the end-of-file. It is the only JCL statement
(other than JES2 statements) that does not begin with "//". Its use is not required
here, but it is recommended. The end-of-file is assumed when the next JCL
statement appears (including comment statements), so never put a JCL comment
immediately after a "DD *" statement.

If the data contains JCL statements, then replace the "*" parameter on the DD statement
with the "DATA" parameter:

//ddname DD DATA
(data card images including JCL)
/*

In this case, "/*" is required to mark the end of the data, therefore delimiters and JES2
statements cannot be included as data.

MVS -9- JCL


Introduction to JCL

6.2 Reading from Existing Disk or Tape Data Sets

Magnetic disk and tape are used for storing data and programs so that the information
can be easily accessed by the computer. The names of frequently used data sets (all disk
and many tape data sets) are listed in the system catalog. The catalog keeps track of the
exact location of each data set.

The minimum DD statement for reading a cataloged sequential disk or tape file is

//ddname DD DSN=data.set.name,DISP=status

• DSN=data.set.name identifies the file to be used.


• DISP=SHR is used for disk data sets. It means that the data set exists but since you
will only be reading it, it may be shared by other jobs.
• DISP=OLD should be used when reading tape data sets. It means that the data set
exists but cannot be shared.

To read a member in a partitioned disk data set, place the member name in parentheses
after the data set name:

//ddname DD DSN=data.set.name(member),DISP=SHR

If a disk data set with a different userid is being read by a FORTRAN program, you
must add the following LABEL parameter to the DD statement

//FTnnF001 DD DSN=data.set.name,DISP=SHR,LABEL=(,,,IN)

Note the three required commas before the word IN. This tells the system that the
FORTRAN program will only read the data set.

Tape data sets that are not cataloged require extra DD parameters to indicate their exact
location. These include the volume serial number assigned to the reel of tape and the
sequence number of the data set on the tape. You must also specify what kind of tape
drive unit will be needed for the tape. At ASU, the unit is "CART". (On rare occasions,
if you're bringing a round reel tape to ASU, you may need to copy the round reel tape
to a cartridge tape. If so, you may be instructed to use "TAPE6250" for the round reel
tape unit.) Most of these tapes also have a standard label in front of each data set that
gives the data set name and the format of the data.

The minimum JCL to read a standard labeled, cartridge tape data set is:

//ddname DD DSN=file,DISP=(OLD,PASS),UNIT=CART,
// VOL=SER=18xxxx,LABEL=n

• DSN=file give the file name, which must match the one on tape.

MVS -10- JCL


Introduction to JCL

• DISP=(OLD,PASS) means the data set exists and the same tape volume may be used
again later in the job.
• UNIT=CART requests a cartridge tape drive unit.
• VOL=SER=18xxxx asks the operator to mount the tape with volume serial number
18xxxx.
• LABEL=n indicates the sequence number of the data set on the tape.

Some tapes have been created on another computer and are now being read on ASU's
IBM system. These tapes usually differ from tapes created here in that they often do not
have labels in front of the data sets. To read these data sets, you must also specify the
format that the data is in.

//ddname DD DSN=file,D ISP=(OLD,PASS),UNIT=CART,


// VOL=SER=18xxxx,LABEL=(n,NL),
// DCB=(RECFM=FB,LRECL=n,BLKSIZE=nnn)

• DSN=file provides the data set name and is optional.


• UNIT=CART requests a cartridge tape drive.
• LABEL=(n,NL) indicates the number (sequential location) of the data set on the
tape. NL specifies that the tape is "non-labeled".
• DCB is the Data Control Block. It gives the format of the data.
• RECFM=FB means "record format is fixed blocked". Most tapes have this
recommended format.
• LRECL is "logical record length" (the number of characters in a record). Card-image
records (length 80) are very common.
• BLKSIZE or "block size" is the number of characters per block or group of records.
The block size must be an exact multiple of the record length. These figures must
match the actual data format on the tape.

6.3 Writing to the Printer

The minimum DD statement for printed output is as follows:

//ddname DD SYSOUT=A

The SYSOUT (SYStem OUTput) parameter tells the computer that this data is to be
printed or plotted. "SYSOUT=A" is the class for ordinary printed output. For available
printers, see section 4.2 above.

6.4 Creating New Disk or Tape Data Sets

Before coding the JCL for a new disk or tape data set, you must make a number of
decisions about the type of data set it will be, where it will be stored, how big it will be,
and exactly what format the data will have.

MVS -11- JCL


Introduction to JCL

Read this section through once before selecting a DD statement format. The parameters
are most fully described when they are first introduced.

6.4.1 Sequential Disk Data Sets

The following DD statement will create a data set in the commonly used card-image
format:

//ddname DD DSN=data.set.name,UNIT=unit,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(p,s),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=7440)

• DSN=data.set.name represents a unique data set name.


• UNIT may be either INSTRC or RESRCH.
• DISP=(NEW,CATLG,DELETE) tells the system to create and catalog a new data set.
If a data set with the same name already exists, another data set will be created but
it won't be cataloged (which causes errors later).
• SPACE=(TRK,(p,s),RLSE) indicates the size of the data set, where "p" is the
estimated number of tracks needed. "s" is a secondary allocation in case the first "p"
tracks are not enough; it should be about 10% of "p".
• DCB= is the Data Control Block.
• RECFM=FB specifies the data format to be card image.
• LRECL=80 indicates each record is 80 characters long. If a different record size is
needed, change LRECL=n to the desired length and BLKSIZE=m to an exact
multiple of "n."
• BLKSIZE=7440 means the records are grouped in blocks of 7440 characters.

A temporary sequential disk data set, which exists only for this job, may be created
with the following JCL:

//ddname DD DSN=&&file,UNIT=SYSDA,
// DISP=(NEW,PASS),SPACE=(TRK,(p,s),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=7440)

• DSN=&&file provides a name for the temporary file. The file name is one to eight
letters or numbers (beginning with a letter) preceded by &&.
• UNIT=SYSDA is used only for temporary disk data sets.
• DISP=(NEW,PASS) indicates that the data set is not cataloged and is to be passed
for use in a subsequent job step in this job only.

6.4.2 Partitioned Disk Data Set

A partitioned data set (PDS) or library can contain several programs or groups of data.
They are called members of the PDS.

MVS -12- JCL


Introduction to JCL

A PDS may be created in one of three ways: empty, by copying an existing PDS, or by
writing a single member for that PDS. The following DD statement can be used for
creating or copying an entire PDS:

//ddname DD DSN=data.set.name,UNIT=unit,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(p,s,d)),
// DCB=(RECFM=VB,LRECL=84,BLKSIZE=7476)

• DSN=data.set.name gives only the name of the data set; no members are specified.
This implies that the data set will be empty or that its members will be copied from
another PDS.
• UNIT=unit is either UNIT=INSTRC or UNIT=RESRCH.
• SPACE=(TRK,(p,s,d)) identifies the data set as a PDS. "p" is the estimated number of
tracks and "s" is a secondary allocation. "d" is the number of directory blocks. The
directory keeps a list of all the members in the PDS. Since one block can hold up to 7
member names, 3-5 blocks should be enough for a directory. Each block is 256 bytes.
• DCB=(RECFM=VB,LRECL=84,BLKSIZE=7476) is for variable format. The card-
image format shown below can be substituted if desired. Whichever is chosen, all
the members will be in the same format.

The following DD statement will create a PDS by writing a single member into it:

//ddname DD DSN=data.set.name(memb er),UNIT=unit,


// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(p,s,d)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=7440)

• DSN=data.set.name(member) specifies both the new data set name and, in


parentheses, the name of the first member.
• DISP=(NEW,CATLG,DELETE) indicates that the entire PDS is new. To write a new
member into an existing PDS, see section 6.5.
• DCB=(RFCFM=FB,LRECL=80,BLKSIZE=7440) specifies a format for card-image
data. The variable format shown above may be substituted. Whichever is chosen, all
subsequent members must be in the same format. When creating a load module
library, use DCB= (RECFM=U,BLKSIZE=15476).

6.4.3 Tape Data Sets

The following DD statement creates a cataloged tape data set on a standard labeled
tape:

//ddname DD DSN=data.set.name,UNIT=CART,
// DISP=(NEW,CATLG,DELETE),VOL=(,RETAIN,SER=18xxxx),
// LABEL=(n,EXPDT=yyddd),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=7440)

MVS -13- JCL


Introduction to JCL

• DSN=data.set.name provides the file name. All cataloged data sets must have a
name which conforms to the TSO (recommended) or WYLBUR naming conventions.
• UNIT=CART specifies a cartridge tape drive unit. An alternative is
UNIT=TAPE6250 when reading a round reel tape. See example below.
• DISP=(NEW,CATLG,DELETE) catalogs the new data set. Substitute
DISP=(NEW,KEEP) if you prefer not to catalog the tape data set.
• VOL=(,RETAIN,SER=18xxxx) gives the volume serial number of the tape reel. The
RETAIN parameter must be used if the tape volume will be accessed again in the
same job.
• LABEL=(n,EXPDT=yyddd) specifies the number (sequential location) "n" of the
data set on the tape. Usually this is one greater than the number of the last data set
on the tape. The data set will be protected from being overwritten until the
expiration date. "yy" is the year, "ddd" is the number of the day of the year.
EXPDT=99365 indicates the data set is to never expire.
• DCB=(RECFM=FB,LRECL=80,BLKSIZE=7440) specifies the same data format
commonly used on disk. The block size must be a multiple of the record length and
cannot exceed 32760. (If the tape is being written in ASCII format, the recommended
maximum is 2000.)

The following DD statement reads a tape data set on an unlabeled round reel tape:

//ddname DD DSN=file,UNIT=TAPE6250,
// DISP=(OLD,PASS),VOL=SER=18xxxx,
// LABEL=(n,NL),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000)

• DSN=file gives the data set name. The names of uncataloged data sets are not
required to conform to the TSO or WYLBUR naming conventions.
• UNIT=TAPE6250 is an obsolete tape format. Not all computer sites have this type of
tape drive anymore.
• DISP=(OLD,PASS) indicates that the data set already exists. PASS allows the tape
volume to be used again later in the job.
• LABEL=(n,NL) indicates the position "n" on the tape. NL indicates "no label".
• DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) uses a small block size for tapes.
Some computers are limited in the maximum block size they can process.

6.5 Adding to an Existing Disk Data Set

New members can be added to an existing partitioned disk data set with the following
DD statement:

//ddname DD DSN=data.set.name(member),DISP=OLD

• DSN=data.set.name(member). If the member name is new, the member is added to


the PDS. If the member name already exists in the PDS, the old member is replaced
by the new one.
• DISP=OLD indicates that the PDS already exists, even if the member is new.

MVS -14- JCL


Introduction to JCL

These new members can be written directly by a program, or copied from a sequential
data set, or copied from a member in another PDS.

It is also possible to add data to the bottom of an existing sequential disk data set with:

//ddname DD DSN=data.set.name ,DISP=MOD

If you are uncertain whether the data set exists or not, use the full DD statement shown
in section 6.4.1, substituting "MOD,CATLG" for "NEW,CATLG,DELETE". If the data set
is not there, it will be created; if it is there, data will be added to the end.

7. ADDING COMMENTS

Comments are words of explanation added to the JCL for human readability. They are
ignored by the computer, unless they are misplaced. Usually the JCL comment
statement is used:

//* comments

The comment statement may be used anywhere after the JOB statement, except in the
middle of instream data (see section 6.1 above). A correct example follows:

// EXEC SPSS
//* FIRST FREQUENCIES RUN
//SYSIN DD *
SPSS statements
/*

Note: Never put a comment statement directly after a "// DD *" statement. Because it is
a JCL statement, the comment will act as an immediate end-of-data marker.

//SYSIN DD *
//* FIRST EXPERIMENT ***WRONG***
(data)
/*

Comments may also be added to the end of other JCL statements. The computer ignores
anything written after a blank in the operand field, for example, in

// EXEC SPSS FREQUENCIES FOR METRO PROJECT

the phrase "FREQUENCIES FOR METRO PROJECT" is taken as a comment.

MVS -15- JCL


Introduction to JCL

8. TERMINATING A JOB

On the IBM system, one job is terminated as soon as another JOB statement is read. You
may also terminate a job with the NULL statement, which has "//" in columns 1 and 2
and nothing else on the line. Using the NULL statement at the end of your job is
recommended.

Note: Be careful. An editing error may place a NULL statement in the middle of your
JCL. If this happens, all the JCL following the NULL statement will be ignored.

9. INTERPRETING YOUR PRINTED OUTPUT

After the banner page, the JOB LOG is the first thing printed. The LOG contains
information pertinent to the entire job, such as when your job started and finished, and
major error messages. This is the first place to look if your job does not work properly.
There may be a message about a "JCL ERROR - JOB NOT RUN". This is usually a
syntax error in your JCL. An explanatory message is usually printed in the system
messages.

The LOG might have a message "IEF450I" that concludes with the words "ABEND
Snnn". This may give additional information regarding the error.

Next comes the JCL listing. Ordinarily you will see only the JCL statements that you
wrote yourself. (If you execute a cataloged procedure and want to see every JCL
statement in the proc printed out, add the keyword parameter MSGLEVEL=(1,1) to the
JOB statement.) The JCL you wrote is printed with the "//" at the beginning. The JCL in
the procedure, if you ask for it, is printed with "XX" at the beginning. JES2 statements
and comments in the procedure begin "***", and JCL in the procedure that has been
modified by one of your own JCL statements begins "X/".

The JCL is followed by system messages and statistics. Both error and informational
messages can be printed here. It is not always easy to tell which is which. If you take
time to study the informational messages that always appear, even when a job runs
correctly, you will find it easier to spot the critical error messages when a job fails.

A complete history of all the data sets used by the job can be traced in the various
operating system messages. This is especially useful if the job does not finish correctly
for some reason.

Another useful message is the condition code "COND CODE" for each step. These
codes are set by the program being executed. For a compiler or standard utility, a
condition code of 0 or 4 is acceptable, and a condition code of 8 or 12 means there were
serious errors in that step.

MVS -16- JCL


Introduction to JCL

Appendix A - JCL Syntax Rules

• Every JCL control statement is divided into four fields, as follows:

//name operator operand comments

• Only columns 1 to 71 may be used. Columns 72 to 80 are ignored.

• Lowercase letters are not allowed except in comments and quoted strings.

• The name field must begin in column 3 and cannot exceed 8 characters (letters,
numbers, or #, @, $). (The characters '#, @, $' are called nationals.) The other fields
are free format.

• There must be at least one blank between fields, but no blanks between the
parameters of the operand field. Anything following a blank is treated as a
comment.

• The operand field may be continued on another line:

• Stop before column 71 and at the end of a complete parameter or sub parameter.
• Include the comma.
• On the next line, put "//" in columns l and 2 followed by at least one blank. The
first parameter on this line must begin somewhere between column 4 and
column 16. If it begins in column 17 or later, the line will be treated as a
comment.
• Additional continued lines are permitted.
• Comments may appear on each line of a continued JCL statement, as long as
they are separated from the operand parameters by at least one blank, e.g.,

//name operation parm,parm, comments


// parm,parm,parm comments

• Positional parameters must be given in the specified order and must precede all
keyword parameters in the operand field.

• All keyword parameters have the format "keyword=variable". They may be coded
in any order, but must follow all the positional parameters.

• A positional parameter or the variable part of a keyword parameter is sometimes a


list of sub parameters. Some sub parameters are positional, others are in keyword
format. Whenever there are two or more sub parameters in a list, the entire list is
enclosed in parentheses.

"DISP=(NEW,CATLG,DELETE)" vs. "DISP=SHR".

MVS -17- JCL


Introduction to JCL

Like parameters, positional sub parameters precede the keyword sub parameters.
The absence of a positional sub parameter is indicated by a comma coded in its
place so long as other positional sub parameters are used after it. For example:

LABEL=(,,,IN)

• The three short JCL statements are:

the Delimiter (end-of-file) /*


the Null (end-of-job) //
the Comment //* comments

• Comment statements can be placed anywhere in the job except immediately after a
"// DD *" statement or in the middle of instream data or before the JOB card
statement.

Appendix B - JES2 Syntax Rules

• JES2 control statements have the following format:

/*operator operand

• Only columns 1 to 71 may be used.

• Lowercase letters are not permitted.

• There must be at least one blank between the operator and the operand. The coding
of the operand field varies.

• JES2 statements cannot be continued in the same way as JCL statements. If all the
operand parameters will not fit on one line, use multiple statements. However, if
any parameters are repeated, only the last one coded is used.

Appendix C - Rules for Data Set Names

• A data set name is composed of one or more segments, 1-8 characters long,
separated by periods. The maximum length is 44 characters, including periods.

• The first character of each segment must be a letter or national (@,#,$); the other
characters can be letters, numbers, national, or hyphen.

• Lowercase letters are not permitted.

• All disk data sets that will exist longer than the duration of one job must be
cataloged.

MVS -18- JCL


Introduction to JCL

• All cataloged data sets must have a name that conforms to the TSO or WYLBUR
naming convention. (The TSO convention is recommended.)

• For the TSO naming convention, the first segment of the data set name is always
your userid. One or more additional segment beyond the first are required.

• For the WYLBUR naming convention, the first segment of the data set name must be
"WYL", the second segment must be the first two characters of your userid, and the
third segment must be the last three characters of your userid. One or more
additional segments beyond the third are required.

• A temporary disk data set may have a one segment name preceded by two
ampersands, for example &&TEMP1.

• The name of a member of a partitioned data set consists of one segment. It is


generally enclosed in parentheses after the data set name, e.g.,
data.set.name(PROG1).

MVS -19- JCL

Вам также может понравиться