Introduction To JCL Objectives
Introduction To JCL Objectives
1. What is JCL?
2. Basic syntax of JCL statements
3. Three types of JCL statements (JOB, EXEC, DD)
4. The JOB statement
5. The EXEC statement
6. The DD statement for tapes
7. The DD statement for printed output
8. OUTPUT JCL statement
9. JES3 control statements
10. Example FORTRAN and SAS programs
11. Sources of Help
1. WHAT IS JCL?
JCL is not used to write computer programs. Instead it is most concerned with input/output--- telling the
operating system everything it needs to know about the input/output requirements. It provides the means
of communicating between an application program and the operating system and computer hardware.
The role of JCL sounds complex and it is---JCL can be downright difficult.
JCL can be difficult because of the way it is used. A normal programming language, however difficult,
soon becomes familiar through constant usage. This contrasts with JCL in which language features are
used so infrequently that many never become familiar.
• consists of individual parameters, each of which has an effect that may take pages to describe
• has few defaults--must be told exactly what to do
• requires specific placement of commas and blanks
• is very unforgiving--one error may prevent execution
JCL is not necessarily difficult because most users only use a small set of similar JCL that never changes
from job to job.
Batch Processing means that you give the computer a whole group of commands, usually in the form of
some sort of program you have written, and have the computer process this group of commands. It is
more like writing a letter.
| | | |
name field operation field operand field comment
field
name field - identifies the statement so that other statements or the system can refer to it. The name field
must begin immediately after the second slash. It can range from 1 to 8 characters in length, and can
contain any alphanumeric (A to Z) or national (@ $ #) characters.
operation field - specifies the type of statement: JOB, EXEC, DD, or an operand command.
operand field - contains parameters separated by commas. Parameters are composites of prescribed
words (keywords) and variables for which information must be substituted.
comments field - optional. Comments can be extended through column 80, and can only be coded if there
is an operand field.
When the total length of the fields on a control statement exceeds 71 columns, continue the fields onto
one or more following statements.
• Interrupt the field after a complete operand (including the comma that follows it) at or before
column 71
• Code // in columns 1 and 2 of the following line
• Continue the interrupted statement beginning anywhere in columns 4 to 16.
JCL should be commented as you would any programming language. The comments statement
contains //* in columns 1 to 3, with the remaining columns containing any desired comments. They can be
placed before or after any JCL statements following the JOB statement to help document the JCL.
Comments can also be coded on any JCL statement by leaving a blank field after the operand field.
DD Data Definition, i.e., Identifies what resources are needed and where to find them
jobname - a descriptive name assigned to the job by the user which is the banner on your printout
- any name from 1 to 8 alphanumeric (A-Z,0-9) or national ($,@,#) characters
- first character must be alphabetic or national
4.1.1 MSGCLASS
The MSGCLASS parameter allows you to specify the output class to which the operating system MVS is
to write the job log or job entry subsystem (JES) messages. If you do not code the MSGCLASS
parameter, MSGCLASS=J is the default and will be used. MSGCLASS=J indicates the output will be
printed on 8 1/2" by 11" hole paper.
• A greenbar paper
• 5-9 TSO held output
• C-Z IBM page printer output classes. See chart in section "Sys-out Classes for IBM Print" on
page 28.
or
A program referred to on the EXEC PGM= statement is a compiled and linked version of a set of source
language statements that are ready to be executed to perform a designed task. It is also known as an
executable load module. It must reside in a partitioned dataset.
// EXEC cataloged-procedure-name
Because the same set of JCL statements are often used repeatedly with little or no change they can be
stored in cataloged procedures. JCL provides programmers with the option of coding these statements
only once, recording and cataloging the statements under an appropriate name in a procedure library,
and then invoking these statements through an EXEC statement. Such a previously established set of
JCL statements is known as a "cataloged procedure." The effect of using a cataloged procedure is the
same as if the JCL statements in the procedure appeared directly in the input stream in place of the
EXEC statement calling the procedure. This saves the user from writing lengthy error-prone JCL
statements. In short, this is JCL that does not have to be included in batch jobs.
Additional statements may be added to the JCL comprising a cataloged procedure at the time of
invocation. Also, operand values on existing JCL statements may be altered or parameters defined in the
procedure may be substituted at invocation time.
The value in the override statement replaces the value for the same parameter in the cataloged
procedure. Cataloged procedure statements must be overridden in the same order as they appear in the
procedure.
//procstepname.ddname DD parameter=value
To modify an existing DD statement, only those operands to be changed need be coded on the modifying
DD statement. The remaining operands of the DD statement within the procedure will be unchanged. If
more than one DD statement in a procedure is to be modified, the modifying DD statements must be
placed in the same order as the original DD statements occur in the procedure.
To add a DD statement to an existing procedure, place the DD statement after the procdure invocation
EXEC statement and any modified DD statements within the job step.
// EXEC SAS
//NEWDD DD DSN=user.file,DISP=SHR
When looking at your output, the following symbols will determine what kind of statement is indicated
when your job runs:
//ddname DD operand,operand,etc.
DD - DD statement identifier
The DD Statement
Instream data is perhaps the most common form of input. To include data in the input stream, code:
//ddname DD *
.
.
.
/* (to specify end of data)
SYSIN is often used as a ddname for instream data. The /* marks the end of the data.
In this example, the userid UGUSER is executing a Fortran procedure with the Fortran program inserted
after the FORT.SYSIN line and the data inserted after the GO.SYSIN line.
In this example, the userid UGIBM is executing a SAS procedure with the SAS program inserted after the
SYSIN line.
//ddname DD UNIT=unittype,
// DSN=userid.name,
// DISP=(beginning,normal-end,abnormal-end),
// SPACE=(TRK,(primary,secondary,directory)),
// RECFM=xx,LRECL=yy,MGMTCLAS=retainx
ddname - data definition name; a 1-8 character word of your choice, must begin with a letter or $, @, #
DD - DD statement identifier
UNIT = unittype - an I/O unit is a particular type of I/O device: a disk, tape, etc. UNIT=SYSDA refers to
the next available disk storage device.
DSN=userid.name DSN parameter names the data set. Data sets can be temporary or nontemporary. A
temporary data set is created and deleted within the job, whereas nontemporary data sets can be
retained after the job completes. A data set name can contain up to 44 characters including periods.
Ex. UGIBM.DATA
mgmtclas - MGMTCLAS specifies the name of the Management Class which is a set of specifications for
the way the storage occupied by the data set should be treated by SMS. Generally, this deals with how
long you want to keep this data set around. UCNS has set up the following management classes:
//ddname DD UNIT=unittype,VOL=SER=unitname,
// DSN=filename,
// DISP=(beginning,normal-end,abnormal-end),
// DCB=(RECFM=xx,LRECL=yy,BLKSIZE=zz,DEN=density),
// LABEL=(file#,labeltype,,mode)
ddname - data definition name; a 1-8 character word of your choice, must begin with a letter or $, @, #
DD - DD statement identifier
UNIT=unittype - an I/O unit is a particular type of I/O device: disk, tape, etc.
TAPE16 refers to a 1600 bpi tape drive
TAPE62 refers to a 6250 bpi tape drive
TAPECA refers to a 38K or XF catridge tape drive
VOL=SER=unitname - VOL=SER parameter is needed if the data set is to be placed on a specific tape
volume. This refers to the volume serial number on an internal tape label.
DSN=filename - DSN parameter names the file on the tape. The filename can be from 1 to 17 characters
in length.
Ex. COWDATA
The DISP parameter describes the current status of the data set (old, new, or to be modified) and directs
the system on the disposition of the dataset (pass, keep, catalog, uncatalog, or delete) either at the end of
the step or if the step abnormally terminates. DISP is always required unless the data set is created and
deleted in the same step.
OLD designates an existing data set; it can be an input data set or an output data set to rewrite
SHR identical to OLD except that several jobs may read from the data set at the same time.
MOD modifies a sequential data set - positions the pointer at the end of the data set in order to add new
data to the data set.
Normal disposition, the second term in the DISP parameter, indicates the disposition of the data set when
the data set is closed or when the job terminates normally. The abnormal dispositions, effective only if the
step abnormally terminates, are the same as normal dispositions except that PASS is not allowed.
PASS passes the data set on to subsequent job steps, and each step can use the data set once.
CATLG catalogs a nontemporary data set. CATLG is similar to KEEP except that the unit and volume of
the data set are recorded in the catalog along with the data set name.
UNCATLG uncatalogs a data set. UNCATLG is the same as KEEP except that the data set name is
removed from the catalog.
All new data sets on disk volumes must be allocated space. Storage on disk volumes can be allocated in
units of blocks, cylinders, tracks, kilobytes, and bytes.
The space may be requested as a primary and a secondary amount. The primary amount is allocated
when the data set is opened with a disposition of NEW. The secondary amount is allocated if the primary
amount is exceeded.
The primary amount can be conservative, with the secondary amount providing a reserve. The secondary
amount provides for data set growth over time.
// SPACE=(TRK,(primary,secondary,directory))
secondary receive this amount of space each time more is needed (up to 15 times)
directory reserve this amount of blocks to keep the directory of a partitioned dataset (NOT USED for a
sequential dataset)
1 directory block allows for 5 members in a partitioned dataset
Any named collection of data is called a data set. A partitioned dataset consists of multiple files within one
data structure. A sequential dataset consists of one file within a data structure.
Partitioned Dataset
Sequential Dataset
A partitioned dataset differs from a sequential dataset in that it has a directory of its members. Whenever
you refer to a member of a partitioned dataset, you include the member name in parentheses.
At the University of Georgia, you are now required to utilize the Data Facilities Storage Management
Subsystem (DFSMS) to establish permanent data sets. The Storage Management Subsystem (SMS) is
an operating environment that automates the management of storage. With SMS, users can allocate data
sets more easily. The data sets allocated through the Storage Management Subsystem are called
system-managed. System-managed means that the system determines data placement and automatically
manages data availability, performance, space, reclamation, and security. One of the most beneficial
goals of System-managed storage is to relieve users of performance, availability, space, and device
management details.
DFSMS stores data in a device-independent format so that it can easily move the data to any of the
following devices:
• Management Class
• Data set Usage
• Minimum percent free space on a DASD Volume
• Request by storage administrator or user
DFSMS records the location of each dataset it moves in a control data set. The actual migration is
handled by DFHSM (Data Facilities Hierarchical Storage Manager). DFHSM is a DASD management
product tool for managing low-activity and inactive data.
Data sets that have reached the end of their retention period (expired) will be deleted. Data sets with a
management class of STANDARD will be deleted if the data set has not been referenced for a period of
eighteen months. A notification will be sent to the user after a STANDARD data set has not been
referenced for six months informing the user of the STANDARD deletion policy. At this time the data set
will be moved to tape.
All data sets that have a management class of RETAIN95 or STANDARD will be automatically backed up
by DFHSM. Two copies of each will be kept. The change indicator will trigger the backup after the first
backup is made. A user can use the HBACK command to add non-STANDARD and non-RETAIN95 data
sets to this.
// SPACE=(TRK,(primary,secondary,directory))
This SPACE example allows a total of 40 tracks for the dataset with 1 block of space reserved for the
directory.
// SPACE=(TRK,(10,2,1))
Total Space = (1*10) + (15*2) = 10 + 30 = 40 tracks
Directory = (1*5) = 5 members/dataset
This SPACE example allows a total of 100 tracks for the dataset with 8 blocks reserved for the directory.
// SPACE=(TRK,(25,5,8))
// SPACE=(TRK,(primary,secondary))
// SPACE=(TRK,(8,3))
This SPACE example allows a total of 520000 bytes for the dataset.
// SPACE=(80,(5000,100))
With SMS, you do not need to use the DCB parameter to specify data set attributes. ALL of the DCB
keyword subparameters (record length, record format, and blocksize) can be specified without the need to
code DCB=.
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
// RECFM=FB,LRECL=80
The blocksize parameter can be omitted because SMS will select the optimum blocksize.
RECFM=xx specifies the record format. The format can be one or more of the following characters:
F fixed-length records
V variable-length records
U undefined-length records
FB fixed and blocked
FBA fixed, blocked, with ANSI carriage control characters
VB variable and blocked
VBA variable, blocked, with ANSI carriage control characters
LRECL=yy specifies the length of records
equal to the record length for fixed-length records
equal to the size of the largest record plus the 4 bytes describing the record's size for
variable-length records
// RECFM=FB,LRECL=80,BLKSIZE=9040
This dataset will have fixed length records with a length of 80. There will be 113 records of data per
block.
// RECFM=VB,LRECL=255,BLKSIZE=3120
This dataset will have variable length records with a maximum of 255 characters. The blocksize of the
dataset will be 3120.
RECFM=xx specifies the record format. The format can be one or more of the following characters:
F fixed-length records
V variable-length records
U undefined-length records
FB fixed and blocked
FBA fixed, blocked, with ANSI carriage control characters
VB variable and blocked
VBA variable, blocked, with ANSI carriage control characters
LRECL=yy specifies the length of records
equal to the record length for fixed-length records
equal to the size of the largest record plus the 4 bytes describing the record's size for variable-
length records
omit the LRECL for undefined records
LRECL can range from 1 to 32760 bytes
DEN=density measures the number of bits that are stored in a unit of measurement on the tape. This
measurement is commonly referred to as BPI (bits per inch).
when adding files to an existing tape all new files will be written at the same density as the
first file no matter if you specify differently.
The LABEL parameter tells the type of label, the relative file number on the tape, and whether the data
set is to be protected for input or output.
// LABEL=(file#,labeltype,,mode)
In this example, the userid UGIBM is executing a Fortran procedure with the Fortran program inserted
after the FORT.SYSIN line, and the data is being read by UNIT 3 from the data set UGIBM.FOOD.
read(3,10) x,y
10 format(1x,f4.1,1x,f4.1)
/*
//GO.FT03F001 DD DSN=UGIBM.FOOD,UNIT=SYSDA,DISP=SHR
/*
//
In this example, the userid UGIBM is executing a SAS procedure with the SAS program inserted after the
SYSIN line and the data is being read from the data set UGIBM.DATA.
/*
//
In this example, the userid UGABC is executing a Fortran procedure with the Fortran program inserted
after the FORT.SYSIN line, and the results are written by UNIT 8 to the data set UGABC.NEWFILE. This
dataset will only be retained for 7 days. If the user decides to keep the dataset for a longer period of time,
the ALTER command can be issued. For example, ALTER 'UGABC.NEWFILE' MGMTCLAS(RETAIN14),
will keep the dataset around for another week. Since the BLKSIZE is not specified, SMS will determine
the most efficient blocksize.
//FORTRUN JOB USER=UGABC
// EXEC FORTVCG,REGION=2000K
//FORT.SYSIN DD *
write(8,10) x,y
10 format(1x,f4.1,1x,f4.1)
/*
//GO.FT08F001 DD DSN=UGABC.NEWFILE,UNIT=SYSDA,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(40,10),RLSE),
// RECFM=FB,LRECL=80,MGMTCLAS=RETAIN7
/*
//
In this example, the userid UGXYZ is executing a SAS procedure with the SAS program inserted after
the SYSIN line and the results are written to the data set UGXYZ.SAS.DATA. This dataset, based on the
management class of standard, will be retained on the system as long as the user utilizes it.
data example;
input x y z;
cards;
123
456
;
data _null_; set example; file newdata;
put x y z;
return;
/*
//
DD - DD statement identifier
SYSOUT=class - defines this data set as a system output data set, usually called a sysout data set and
assigns this sysout data set to an output class. Here is a list of available output classes:
• A greenbar paper
• 5-9 TSO held output
• C-Z IBM page printer output classes. See chart in section "Sysout Classes for IBM Print" on page
28.
* Note that if a sysout data set has the same class as the MSGCLASS parameter, the job log appears on
the same output listing as this sysout data set.
Graybar Overlay: The paper used for classes C,F,H,J, and Q is shaded to mimic standard greenbar
paper.
Service Site Page Printers: To route your output to one of the page printers in the Journalism or Aderhold
sites, you must use a SYSOUT class or message class (MSGCLASS) with a paper type of "hole" (C, D, J,
K, W, or Z).
Line Printer SYSOUT Class: To route your output to a line printer, use a SYSOUT class or message class
(MSGCLASS) of A. Your output will be printed on greenbar paper.
Special Hold Classes: To route your output to a hold queue, use a SYSOUT class or message class
(MSGCLASS) of 5, 6, 7, 8, or 9.
------------------------
PAGEDEF=pdef - specifies the logical page length and width, fonts, lines within a page, and multiple
logical pages on a physical page
POR1 portrait, 62 lines at 6 lines per inch
POR2 portrait, 70 lines at 6 lines per inch
POR3 portrait, 2 up format, 62 lines per frame
LAN1 landscape, 62 lines at 8 lines per inch
LAN2 landscape, 2 up format, 80 lines per frame
COPIES=n - specifies how many copies of the sysout data set are to be printed
DEST=dest - specifies a printer destination for the sysout data set
LOCAL Boyd Graduate Studies
SSS02 Journalism Building
SSS03 Aderhold Building
NCT19 Brooks Hall
DEFAULT=dd - specifies that this OUTPUT statement can or cannot be referenced by a sysout DD
statement
YES specifies that this is the default OUTPUT statement for for all print files within a job
NO specifies that this is not the default OUTPUT statement
* Note if you are going to HOLD a print dataset with an OUTPUT statement associated with it, you will
have to fully specify all of the parameters on the OUTPUT statement. Contact the UCNS Helpdesk for
more details.
To request simplex (one sided) printing for a duplex sysout class for all print files, code:
- with -
//ddname DD SYSOUT=F,OUTPUT=*.OUT1
//*MAIN CLASS=x,LINES=y,ORG=UGAIBM1.org
CLASS=x specifies the job class for this job
B Batch (default) Anytime daily
NITE 6:00 PM until 7:00 AM daily
WEEKEND 6:00 PM Friday until 7:00 AM Monday
Z 1:30 AM until 7:00 AM daily, weekends, holidays
BL 6:00 PM until 7:00 AM daily, more than 8 MEG region
ZL 1:30 AM until 7:00 AM daily, more than 8 MEG region
LINES specifies the maximum number of lines of data to be printed from this job in multiples of a
thousand (default = 5000)
Priority
-------
___________
BATCH | 4
|
| __________ 3
____
NITE | ____ 2
//*MAIN CLASS=NITE
or
//*MAIN CLASS=WEEKEND
The //*OPERATOR statement is primarily used to issue a message to the operator requesting that the
tape with the specific VRN, VSN and KEYWORD is to be mounted for the job.
VRN will be assigned when the tape is checked in. This identifies the tape in the tape library. Cartridge
Tapes must have #C in the first two column positions on the vrn parameter.
VSN the volume serial number on the the internal label of a standard labeled tape. This must be the
actual internal label. For non-labeled tapes, this can be any arbitrary name. In both cases, the VSN must
match the VOL=SER parameter on the DD card.
KEY is a password that you will assign to the tape for security purposes. The operator will check the
keyword in your JCL against the keyword on the tape before mounting the tape.
The //*Operator statement in the JCL stream is placed after the JOB or //*MAIN statement and before the
EXEC statement. Each //*Operator statement should be referenced by a DD statement to read or write a
file to the tape.
The following example illustrates the operator card with the referencing DD statement. Note that the VSN
and the VOL=SER must be the same. In this example, the user is going to read the first file on a standard
labeled (SL) tape with the name COWDATA. The tape is going to be read on a 6250 BPI tape drive.
In this example, the userid UGA001 is executing a Fortran procedure with the Fortran program inserted
after the FORT.SYSIN line and the data inserted after the GO.SYSIN line. This job will not begin
executing until after 6:00PM, and the output will be held to the terminal by the MSGCLASS=6.
read(5,10) cent
10 format(f6.2)
fahr=(cent*9/5)+32
write(6,20) cent,fahr
20 format(f6.2,' cent = ',f6,2,'fahr')
/*
//GO.SYSIN DD *
100.00
/*
//
In this example, the userid RESRCH is executing a SAS procedure with the SAS program inserted after
the SYSIN line and the data is being read from the first file of a standard labeled cartridge tape with the
file name of DATAFIL. The output will go directly to the printer with the sysout class of S.
data one;
infile sampdata;
input a b c d;
proc print;
/*
//
11. SOURCES OF HELP
• IBM MVS JCL Publication No. GC28-1300 - This manual is the basic reference document on the
syntax and usage of IBM JCL. This manual is available for reference at the Client Services Help
Desk.
• System/370 Job Control Language by Gary Deward Brown - This reference is a standard and
popular textbook for introducing IBM JCL to persons familiar with computers but not necessarily
IBM 370 systems.