Escolar Documentos
Profissional Documentos
Cultura Documentos
(JCL)
C S C. C O M C O N S U L T I N G • S Y S T E M S I N T E G R A T I O N • O U T S O U R C I N G
1
What is JCL?
2
What is a Job and a Job Step?
3
Functions of JCL Statements
4
Sample JCL
//TNDR101A JOB ‘SAMPLE JOB’, CLASS=S
//STEP01 EXEC PGM=REPORT
//INPUT DD DSN=CUSTOMER.FILE,
// DISP=SHR
//OUTPUT DD DSN=REPORT.FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80),
// SPACE(TRKS,(100,20),RLSE)
//SYSOUT DD SYSOUT=*
5
Job Entry Subsystem
The JES is the MVS component that keeps
track of jobs that enter the system, presents
them to MVS for processing, and sends their
spooled output to the correct destination.
JES2 and JES3 are its two versions.
6
Life Cycle of a Typical Job
7
How a Job is entered into the
Subsystem ?
8
How a Job is scheduled for
execution ?
Job Class
A single character, either a letter (A-Z) or
a digit (0-9)
Priority
Class Initiators
9
How a Job is Executed ?
Interpreter
Allocation Routines
Initiator loads the program into the user’s region
Unallocation Routines
Sysin or In-stream Data
Sysout Data
10
How a Job’s Output is Processed ?
11
How a Job is Purged ?
12
Structure of a JCL Statement
JCL statements are coded in 80-byte records
However, only 72 of the 80 characters are
available to code JCL. The last eight columns
of each record are reserved for an optional
sequence number.
13
The Identifier Field
14
The Name Field
15
The Operation Field
Specifies the statement’s function
JOB, EXEC, and DD are the different operation
fields
Should be separated from the Name field by
atleast one blank
16
The Parameters Field
Begins at least one position after the end of the
operation field and can extend into column 71
Can contain sub-parameters
Two types of parameters - Keyword and
Positional
Positional parameter must occur in a specific
position within the parameters field
If omitted, should be replaced with commas
Keyword parameters can be coded in any order
17
The Comments Field
Begins in the position after the space that
marks the end of the parameters field and ends
in column 71
To use an entire line as a comment, code //*
starting from column 1 of the JCL record
18
How to Continue JCL
Statements ?
Break the parameter field after the comma that
follows a parameter or sub-parameter
Code slashes in columns 1 and 2 of the following
line
Code the next parameter beginning anywhere in
columns 4 through 16
19
The JOB Statement
It identifies a job to MVS and supplies a job
name that MVS uses to refer to the job.
It supplies accounting information so that MVS
can determine who is responsible for the job
It supplies various options (like the Class
parameter) that influence or limit how the job is
processed.
20
The Job Statement (Contd…)
21
The Job Name
22
Accounting Information
23
Programmer Name
24
User and Password
25
Class
26
Notify
27
MSGCLASS and MSGLEVEL
Controls the output messages
MSGCLASS lets you specify an output class
where the system messages can be directed,
like a printer
Example: MSGCLASS=X
28
MSGCLASS and MSGLEVEL (Contd…)
The MSGLEVEL parameter lets you specify the
type of messages you want included in your
output.
Has two sub positional parameters - STMT and
MSG
Stmt controls which JCL statements appear in
the JCL statement listing.
Msg, controls the amount of message output
that appears in the message log
29
Stmt Values
30
MSG Values
0- Print step completion messages only;
don’t print allocation and
deallocation messages unless the job
fails
1- Print all messages
31
Time
32
The EXEC Statement
Identifies each step in a job
Format:
//stepname EXEC PGM=pgm-name
[,PARM=information]
[,COND=([(code,operator,step)…]
[,EVEN/ONLY])]
33
The EXEC Statement (Contd…)
The PGM parameter specifies the name of the
program that will be executed by the job step
In the PARM parameter, you can code
information that can be accessed by the
program you specify in the PGM parameter
34
The COND Parameter
When a program completes execution
(normally or with an abend), it passes a value
called a return code back to MVS.
Most common return-codes are 0,4,8,12 and
16. Zero indicates that the job has completed
successfully and 16 indicates that a severe error
has occurred during the execution of the
program.
35
The COND Parameter (Contd…)
Using the COND parameter, you can decide
to execute a step based on the return code of
the previous step(s)
Format:
COND=(CODE,OPERATOR,STEPNAME)
Example:
//STEP020 EXEC PGM=PRINT,
COND=(4,LT,STEP010)
36
The COND Parameter (Contd…)
The previous COND statement should be read
as ‘IF 4 IS LESS THAN THE RETURN CODE
OF STEP010, THEN STEP020 WILL NOT
EXECUTE’
Some more examples:
1. COND=(7,LT)
2. COND=((8,EQ,STEP1),(12,LE,STEP2))
37
The COND Parameter (Contd…)
38
The DD Statement
39
DD Statement for DASD Data Sets
//ddname DD DSNAME=data-set-name,
// DISP=(status,normal-disp,abnormal-disp)
// [,UNIT=unit]
// [,VOL=SER=vol-ser]
// [,SPACE=unit,(primary,secondary,dir)]
// [,DCB=(option,option…)]
40
DSNAME Parameter
The DSNAME parameter supplies the data
set name as it is stored in the data set’s label
or in the file’s catalog entry.
Examples:
//INPUT DD DSNAME= TNDR101.CUST,
// DISP=SHR
//DD1 DD DSN=TNDR101.COBOL(PGM1),
// DISP=OLD
41
DISP Parameter
The Disp parameter describes the disposition
or the status of a data set
It tells MVS how to handle the data set after
the end of the step or job.
Parameter supplies the data set name as it is
stored in the data set’s label or in the file’s
catalog entry.
Has three positional sub-parameters: status,
normal disposition, and abnormal disposition.
42
DISP Parameter
43
DISP Parameter
Status
NEW The data set does not exist
and should be created
OLD The data set exists and
should be allocated for
exclusive use
SHR The data set exists and
should be allocated for
shared use
MOD The data set is allocated for
exclusive use and is
positioned at the end of the
data, so additional records
may be added after the last
record
44
DISP Parameter
Normal and abnormal disposition
DELETE The data set is deleted and also
uncataloged
KEEP The data set is retained
CATLG The data set is retained and a
catalog entry is made
UNCATLG The data set is retained, but its
catalog is removed
PASS Normal disposition only. The
data set is retained for use by a
later job step
45
DISP Parameter
Default Values
Status If omitted, MVS assumes
NEW
Normal Disposition Depends on the value
specified or assumed for
status; if NEW, normal
disposition is DELETE; if
OLD, SHR, or, MOD, normal
disposition is KEEP
Abnormal Disposition Takes on the value specified
or assumed for normal
disposition
46
DISP Parameter - Examples
DISP=SHR Allocate an existing data set for shared
access; normal and abnormal default to
KEEP
DISP=OLD Allocate an existing data set for exclusive
access; normal and abnormal disposition
default to KEEP
DISP=MOD If the data set exists appends data to it;
otherwise, create it. Access is exclusive;
normal and abnormal disposition default to
KEEP
DISP=(NEW,CATLG) Allocate a new data set and catalogs it;
abnormal disposition defaults to CATLG
DISP=(OLD,DELETE) Allocate an existing data set and delete it;
abnormal disposition defaults to DELETE
DISP=(,KEEP,DELETE) Allocate a new data set and keep it if the job
step ends normally, if the job step ends
abnormally, delete the data set
47
UNIT and VOLUME Parameters
UNIT indicates the device where the data
set resides (like, DASD or tape)
VOLUME indicates the VOL-SER of the
data set’s volume
Required when you are creating a data set
Not required when you are retrieving/using
a cataloged data set, as these details are
stored in the catalog
48
SPACE Parameters
Tells MVS how much primary and secondary
space need to be allocated to the dataset
Format:
SPACE=(unit,(primary,secondary,dir))
Unit indicates the unit of measure used for
space allocation - cylinders(CYLS), Blocks
(BLKS), Tracks (TRKS) etc.
The PRIMARY parameter indicates how
many units of space to allocate for the data
set’s primary extent
49
SPACE Parameter
If the file requires more space than the
primary allocation, up to 15 secondary
extents can be allocated, each as large as the
secondary amount you specify.
The dir sub-parameter is only for
partitioned data sets. It gives an indication
on the number of members your PDS can
hold.
Examples: SPACE=(CYL,(10,2))
SPACE=(TRK,(5,2))
SPACE=(CYL,(4,1,5))
50
DCB Parameter
51
DCB Parameter
DSORG=XX Specifies the data set’s organization, as follows:
PS Physical Sequential
PO Partitioned
DA Direct
IS Indexed Sequential
RECFM=n Specifies the format of the file’s records, as follows
F Fixed length, unblocked
FB Fixed length, blocked
V Variable length, unblocked
VB Variable length, blocked
VBS Variable length, blocked, spanned
U Undefined
LRECL=n Specifies the length of the file’s records
BLKSIZE=n Specifies the length of the file’s records; for FB, BLKSIZE
is normally a multiple of LRECL
52
DCB Parameter
Examples of DCB parameter
53
DD Statement for In-Stream
Data Sets
54
DD Statement for In-Stream
Data Sets
Example of an in-stream data set
//STP0100 EXEC PGM=REPORT
//CUSTMAST DD DSN=TRG0001.CUSTOMER.MAST.FILE,
// DISP=SHR
//NAMELIST DD *
ROBERT
ASHOK DESAI
ROSALINE
JAMES MATHEW
/*
//RPTFILE DD DSN=TRG0001.REPORT,
// DISP=(,CATLG,DELETE),
.
.
.
55
The DATA parameter
Used to code JCL statements as part of in-
stream data
Must code the delimiter to mark the end of
your data
* Example:
//SYSUT1 DD DATA
//STEP1 EXEC PGM=SAMPLE
//DD1 DD DSN=TRG0001.TEST,DISP=SHR
/*
56
The DLM parameter
Used to specify an alternate delimiter
Essential when /* is a part of the in-stream
data
Example:
//SYSIN DD DATA,DLM=$$
A0010100599CH45
A0010306324AB23/*
B0123034CD/*
$$
57
DD statement for SYSOUT
data sets
SYSOUT parameter on a DD statement
indicates that a file is a SYSOUT data set and
should be processed by the JES.
It also specifies the output class associated
with the SYSOUT data set
Example:
//REPORT DD SYSOUT=A
58
The NULL statement
Purpose is to mark the end of the job
Consists of two slashes in columns 1 and 2
and no other data in the rest of the record
* By default, MVS processes your JCL till the
last record and then terminates
59
The COMMENT statement
Purpose is to add comments in a job
Comment lines begin with two slashes and an
asterisk column 1
Example:
60
The DUMMY data set
A dummy data set is a data set that doesn’t
really exist
MVS simulates the data set
* When a program tries to read a record from a
dummy file, MVS indicates an end-of-file
condition
* When a program writes a record to a dummy
file, the data is discarded.
62
Temporary Data Sets (Contd…)
Rules for coding a multi-step temporary data
set:
1. DSNAME follows a special format - must be
preceded by two ampersands, has only one
qualifier which is no longer than eight
characters
Example: &&TEMP and &&ACCOUNT
2. DISP=(NEW,PASS) in the step where it is
created
3. DISP=(OLD,PASS) in steps where it is used
4. DISP=(OLD,DELETE) in the last step where
it will be deleted
63
Example of multi-step
Temporary data set
//TNDR101A JOB MSGCLASS=X, CLASS=A
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=TNDR101.CUSTOMER.MASTER,
// DISP=SHR
//SORTWK01 DD UNIT=SYSDA,SPACE=(TRK,(1,1)
//SORTWK02 DD UNIT=SYSDA,SPACE=(TRK,(1,1)
//SORTWK03 DD UNIT=SYSDA,SPACE=(TRK,(1,1)
//SORTOUT DD DSN=&&SORTCUST,
// DISP=(NEW,PASS), UNIT=SYSDA,SPACE=(TRK,(1,1)
//SYSIN DD *
SORT FIELD=(2,13,A,20,1,A),FORMAT=CH
/*
//STEP020 EXEC PGM=IEFBR14
//SYSOUT DD SYSOUT=*
//CUSTMAST DD DSN=&&SORTCUST,DISP=(OLD,DELETE)
//SYSUDUMP DD SYSOUT=*
64
Concatenating data sets
To concatenate files,
1. Code the first DD statement just as you
normally would.
2. Then, code the next DD statement directly
after it, but don’t code a DD name for it.
Example:
//TRANS DD DSN=TNDR101.TRANS.WEEK1,
// DISP=SHR
// DD DSN=TNDR101.TRANS.WEEK2,
// DISP=SHR
// DD DSN=TNDR101.TRANS.WEEK3,
// DISP=SHR
65
JOBLIB and STEPLIB
By default, MVS searches the system libraries to
find the load module of the PGM mentioned in
the EXEC statement
To point to the private libraries where your load
modules of your programs are located, you can use
JOBLIB and STEPLIB DD statements
* A Job library (JOBLIB) applies to all programs
executed by the job; a step library (STEPLIB)
applies only to the step where it is mentioned
66
JOBLIB and STEPLIB
To specify a job library, you code a DD statement
using JOBLIB as the ddname.
The JOBLIB DD statement must be the first JCL
statement following the JOB statement.
Example:
//TNDR101F JOB CLASS=B,USER=TRG0006
//JOBLIB DD DSN=TNDR101.PDS.LOADLIB,
// DISP=SHR
//STEP1DD EXEC PGM=IEBGENER
.
.
//STEP2DD EXEC PGM=REPORT
67
JOBLIB and STEPLIB
To specify a step library, you code a DD
statement named STEPLIB after the EXEC
statement for the step in which you want the step
library to apply.
70
Types of PROCEDURES
Two types of procedures - Catalog and In-stream
72
The PEND Statement
73
The JCLLIB Statement
Identifies a private library or a system library
from which the Cataloged procedures are to be
retrieved.
Format:
//name JCLLIB ORDER=(pds-1, pds-2…)
Example:
//XYZ JCLLIB ORDER=(TNDR101.TEST.PROCLIB,
// TNDR101.PDS.PROCLIB)
74
EXAMPLE OF A CATALOGED
PROCEDURE
//SORTPROC PROC
//STEPSORT EXEC PGM=SORT
//SORTIN DD DSN=SORTIN.FILE,DISP=SHR
//SORTOUT DD DSN=SORTOUT.FILE,
// DISP=(,CATLG), UNIT=SYSDA,
// SPACE=(CYL, (10,2)),
// DCB=(LRECL=80,BLKSIZE=80,RECFM=FB)
//SORTLIB DD DSN=SYS1.SORTLIB,
// DISP=SHR
//SYSOUT DD SYSOUT=A
//SORTPROC PEND
75
EXAMPLE OF A CATALOGED
PROCEDURE
To invoke the above procedure:
//SORTJOB JOB (IBM, TRNG),`SORT PROGRAM’,CLASS=A,
// USER=TNDR101,NOTIFY=TNDR101
//*
//USERPROC JCLLIB ORDER=(TNDR101.PDS.PROCLIB)
//*
//STEP1 EXEC PROC=SORTPROC
//
76
In-Stream PROCEDURE
Completely contained within the JOB
String of JCL statements appearing between a
PROC & PEND statement within a JOB
* Should be coded immediately after the JOB
statement and before the first EXEC statement
* Available to only one JOB
* A total of 15 procedures can be defined within a
JOB
* Within a JOB, the procedure can be invoked any
number of times
77
In-Stream PROCEDURE
//PROC1 PROC
//S1 EXEC PGM=PGM1
//PRODFILE DD DSN=PRODUCT.MSTER,
// DISP=OLD
//REPORT DD SYSOUT=A
//PROC1 PEND
//STEP010 EXEC PGM=UPDATE
//TXN DD DSN=UPDATE.TXN,
// DISP=OLD
//MASTER DD DSN=PRODUCT.MSTER,
// DISP=OLD
//STEP020 EXEC PROC=PROC1
78
Overrides
Three types of overrides:
1. Modifying parameters coded on EXEC
statements within the procedure
2. Modifying parameters coded on DD statements
within the procedure
3. Adding entirely new DD statements within the
procedure
All the above three types of overrides hold good
for both cataloged and in-stream procedures
79
Overrides
Modifying parameters coded on EXEC
statements
Format:
Parameter.procstepname=value
* Example:
//S1 EXEC INV3000, COND.STP0200=(4,LT)
* Modifying parameters coded on DD statements
Format:
//procname.ddname DD parameter=value
* Example:
//STEPA EXEC INV3000
//INV3010.SYSOUT DD SYSOUT=C
80
Overrides
Adding a DD statement
Example:
//STEPA EXEC INV3000
//INV3010.INVMAST DD
// DSN=TRG0001.INV.MSTR,
// DISP=SHR
81
Symbolic parameters
Symbolic parameters are very much like
program variables
A symbolic parameter is a symbol preceded by an
ampersand that stands for a parameter, sub-
parameter or value
* Makes the procedure more flexible & general
purpose
* Can be 1-7 characters, alphanumeric or national,
preceded by &
82
Symbolic parameters
83
Symbolic parameters - Examples
//INV3000 PROC
//STEP010 EXEC PGM=INV3010
//SYSOUT DD SYSOUT=&CLASS
//INVMAST DD DSN=&FRSTNODE..INVENTRY.MASTER,
// DISP=SHR
//INVSEL DD DSN=&&INVSEL,DISP=(NEW,PASS),
// UNIT=DISK,SPACE=(CYL,(&SPACE))
//SELCTL DD DUMMY
//STEP020 DD PGM=INV3020,COND=(0,LT)
//SYSOUT DD SYSOUT=&CLASS
//INVMAST DD DSN=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=*
//STEPA1 EXEC
INV3000,CLASS=M,FRSTNODE=TNDR101,SPACE=’5,1’
84
How symbolic parameter
values are used?
Assume that VAR1=TEST and VAR2=LIST
As coded in procedure As interpreted by MVS
DSNAME=&VAR1. DSNAME=TEST
DSNAME=A&VAR1. DSNAME=ATEST
DSNAME=&VAR1.(&VAR2.) DSNAME=TEST(LIST)
DSNAME=&VAR1.A DSNAME=TESTA
DSNAME=&VAR1..A DSNAME=TEST.A
DSNAME=&VAR1.&VAR2. DSNAME=TESTLIST
DSNAME=&VAR1..&VAR2. DSNAME=TEST.LIST
85
Assigning Default Values to
Symbolics
Procedure
//INV3000 PROC CLASS=’*’,SPACE=’1,1’
//STEP010 EXEC PGM=INV3010
//SYSOUT DD SYSOUT=&CLASS.
//INVMAST DD DSN=&FRSTNODE..INVENTRY.MASTER,
// DISP=SHR
//INVSEL DD DSN=&&INVSEL,DISP=(NEW,PASS),
// UNIT=DISK,SPACE=(CYL,(&SPACE.))
//SELCTL DD DUMMY
//STEP020 DD PGM=INV3020
//SYSOUT DD SYSOUT=&CLASS.
//INVMAST DD DSN=&&INVSEL,DISP=(OLD,DELETE)
//INVSLST DD SYSOUT=&CLASS.
87