What Is JCL?
What Is JCL?
//jobname
JOB USER=userid, TIME=m,
MSGCLASS=class, NOTIFY=userid
or
// EXEC PGM=pgmname
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
Modifying Cataloged
Procedures
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
You can modify cataloged procedures by:
Overriding parameters in an existing DD statement
Adding DD statements to the procedure. To add new DD statements let them follow
any changed DD cards for that step.
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:
// Indicates JCL statements
XX Indicates cataloged procedure statements
X/ Indicates a modified cataloged procedures statement
DATA DEFINITION (DD) STATEMENT
A DD (Data Definition) statement must be included after the EXEC
statement for each data set used in the step. The DD statement gives the
data set name, I/O unit, perhaps a specific volume to use, and the data set
disposition. The system ensures that requested I/O devices can be
allocated to the job before execution is allowed to begin.
The DD statement may also give the system various information about the
data set: its organization, record length, blocking, and so on.
//ddname DD operand,operand,etc.
ddname - a 1 to 8 character name given to the DD statement
DD - DD statement identifier
operand - parameters used to define the input or output dataset
The DD Statement
appears after an EXEC statement
gives the system information on many things, including the dataset
attributes, the disposition of the dataset when the job completes, and
which input/output device(s) to use
6.1 DD STATEMENT FOR INSTREAM DATA Instream data is perhaps the
most common form of input. To include data in the input stream, code:
DATA DEFINITION (DD) STATEMENT FOR DISK
DATASETS
//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:
DATA DEFINITION (DD) STATEMENT FOR
TAPE DATASETS
//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
Disposition (DISP) Parameters
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. // DISP = (beginning, normal-
termination ,abnormal-termination)
_________ _________________
___________________
| | |
NEW CATLG DELETE
OLD KEEP KEEP
SHR PASS CATLG
MOD DELETE UNCATLG
UNCATLG
Normal Termination and Abnormal Termination
Dispositions
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.
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
can be specified as:
// RECFM=FB,LRECL=80