Job Control Language (JCL) : What Is JCL? Structure of JCL
Job Control Language (JCL) : What Is JCL? Structure of JCL
Why JCL?
Job Control language is a flexible, powerful and unique language that runs in an IBM Mainframe environment. In addition
to above charateristics, it appears to be quite incomprehensive and not user-friendly. Unlike programs written in
programming languages like C, C++, PASCAL, FORTRAN, and COBOL etc. compiled under PC, MS-DOS or UNIX operating
systems for the programs written in such languages to run on IBM-mainframe environment you have to submit the job to
mainframe operating environment through JOB CONTROL LANGUAGE (JCL).
JCL was created at a time when "user friendly" environments were not an issue, instead power and flexibility were. Job is
a collection of statements that specify the resources required to run the job by the operating system. A mainframe is one
of the greatest creation of mankind. It is something like, if you are working with the mainframe that actually means that
you are the person working with the REAL computer with your colleagues. JCL is not a procedure Oriented Language like
COBOL, PASCAL, C.. ect. JCL is not a Object Oriented Language like C++ or small talk. It has a uniquely identifying
characters of its own, it is a job control language. JCL will identify to the operating system the resources that your
program expects to use. It is the interface between the Application program and the MVS operating system that your
program will run in. Without JCL your programs will not run in the IBM-Mainframes.
INTRODUCTION TO JCL
WHAT IS JCL?
STRUCTURE OF JCL
what should be done with those datasets once the program(s) end(s).
1
JCL
All the Steps in a Job are executed sequentially i.e. one after the
other.
1. IDENTIFIER FIELD
2. NAME FIELD
3. OPERATION FIELD
4. PARAMETER FIELD
5. COMMENT FILED:
2
JCL
1. Objectives
2. Purpose of the JOB statement
3. Syntax
4. Parameters
• TYPRUN
5. Examples
6. Summary
OBJECTIVES OF JOB STATEMENT
Understand what the JOB statement accomplishes
3
JCL
Code the different JOB statements depending on the need of the Job
• To identify the Job and the person who submitted the Job.
• Specify which Class the Job is to belong to.
• Specify how the output should be handled.
• To make an entity or group accountable for the execution of the Job.
• The JOB statement should always be the first statement in a Job.
• You can code more than one Job in the same member
Example:
You can give the same Jobname for more than one of your Job. Internally the Job
gets assigned a unique Job identification number.
4
JCL
Appears at the bottom of every page of printed output for the Job.
Examples:
All the Steps in a Job are executed sequentially i.e. one after the other.
1. IDENTIFIER FIELD
2. NAME FIELD
3. OPERATION FIELD
4. PARAMETER FIELD
5
JCL
5. COMMENT FILED:
CLASS
Syntax:
CLASS=Class
(1 Character. Installation dependent. 'A' thru 'Z' and '0' thru '9')
Example:
CLASS=X
As we have seen in Unit 1, the Class of a Job determines the input priority (a basis
for Initiator selection)
As most installations do not prefer the users specifying the dispatching priority for
their Jobs, the Class parameter provides a less explicit way to specify the input
priority. For example, the user might select a Class, which most Initiators can
handle.
MSGCLASS
Syntax:
MSGCLASS=Message-class
6
JCL
MSGCLASS=A
• Using the MSGCLASS parameter, you can tell the system how to handle the
output of your Job.
• The valid values that you can specify for this parameter are dependent on
your installation.
• In one installation, MSGCLASS=Z may mean that the output has to be
immediately routed to a printer. In another installation, it may mean that the
output has to be held in the Output Queue for later retrieval.
NOTIFY
Purpose: To specify which user is to be notified after the Job finishes execution.
Syntax:
NOTIFY=User-Id
Example:
NOTIFY=USERID
NOTIFY=MAIN006
• Once the Job ends execution, in case someone has to be notified about the
completion along with the maximum return-code (discussed later) of the Job
or, the Abend Code, the NOTIFY parameter has to be used.
• Once the Job finishes, if the user specified in NOTIFY has logged on, he will
get the message once he presses ENTER or any other Attention Identifier Key.
If he is not logged on, he will get the message(s) along with his logon
prompts the next time he logs on.
MSGLEVEL
Purpose: To specify how much output has to be generated for this Job by the system.
Syntax:
MSGLEVEL=(a,b)
a: Specifies how much of the Job has to be printed in the output (job log).
Valid values are 0, 1 and 2
0 - Print only the Jobcard (JOB statement of the Job)
7
JCL
1 - Print all JCL and JES statements including all statements in procedures, if any
2 - Print only submitted JCL and JES statements. Statements in
procedures are not printed.
Examples:
MSGLEVEL=(1,1)
MSGLEVEL=(,1)
MSGLEVEL=(2,)
REGION
Purpose: To limit the maximum amount of memory that the Job can utilize.
Syntax:
REGION=nnnnnnnK
or
REGION=nnnnM
n: Numeric value
Valid ranges :
K: Kilobytes
M: Megabytes
Examples:
REGION=1024K
REGION=1M
8
JCL
• REGION need not be explicitly coded unless specified in the documentation for
certain utilities.
• If REGION=0K or REGION=0M is coded, the system assumes a default region
size.
TIME
Purpose: To specify the maximum processor time that the Job can utilize.
ON JOB STATEMENT
MAX CPU TIME FOR JOB
ON EXEC STATEMENT
MAX CPU TIME FOR STEP
1. The TIME parameter can be used to specify the maximum length of CPU time that
a job or job step is to use the processor.
2. If coded on the JOB statement, this is the total time for all steps.
3. If coded on an EXEC statement, it is the maximum time for this step.
4. Any combination of minutes and seconds can be coded. However, there are three
values for the parameter that have a special meaning:
EXAMPLE
• The entire job will be limited to a maximum of 1 minute and 30 seconds. The
first step will be limited to a maximum of 1 minute.
9
JCL
• Note that the submitter is apparently asking that the last step not be
timed.However, coding TIME=NOLIMIT on the last step will NOT accomplish
this Objective. The TIME=(1,30) on the JOB statement will limit the maximum
time for step 3 to 1 minute and 30 seconds. What will be the minimum time
available to step 3?
• How could the submitter modify the JOB statement time so that step 3 would
not be timed?
RESTART
Purpose: To begin the execution of the Job from a Step other than the first one.
Syntax:
RESTART=Stepname
Example:
RESTART=STEP2
• If you want to skip one or more of the initial steps in the Job before starting
execution, use the RESTART parameter.
• For example, if you have run a Job with 2 steps, the first step runs and the
second step abends. You make the changes in the second step to set right
any error causing statement or parameter. Now, you will require running only
the second step. Therefore, you change the Job statement and add the
RESTART parameter to start execution from the second step onwards.
• If the time consumed by a job (or step) exceeds the value specified for the
TIME parameter for that job (or step), the job ABENDS.
TYPRUN
Syntax:
TYPRUN=SCAN
TYPRUN=HOLD
TYPRUN=COPY
SCAN: Only check the Job for syntax errors. Do not execute the Job.
HOLD: Check the Job for syntax errors and hold it in the Input Queue.
10
JCL
• With SCAN, the Job gets checked for syntax errors. The output, including
error messages, if any, is directly sent to the Output Queue.
• With HOLD, the Job is checked for syntax errors. If no errors are present
then, the Job is held in the Input Queue from where the operator will have to
release it for execution.
• With COPY, no syntax checking or execution takes place. The source content
of the Job immediately gets directed to the Output Queue.
It is a good practice to code individual parameters on separate lines as, if one of the
parameters needs to be cancelled, all you need to do is comment out the line
containing the parameter.
SUMMARY OF JOB STATEMENT
Knowledge supposedly gained after this unit
Syntax
Parameters
• PGM
• PROC
11
JCL
• REGION
• TIME
• PARM
Examples
- To specify the system requirements for each step if not coded in the JOB
statement.
There can be a maximum of 255 steps in a Job. In other words, one Job can execute
a maximum of 255 programs.
Example:
or
or
PGM
Syntax:
PGM=Program-name
Example:
12
JCL
PGM=MYPROG
PROC
Syntax:
PROC=Procedure-name
Example:
PROC=MYPROC
REGION
Purpose: To specify the maximum memory that the step can utilize.
Syntax:
REGION=nnnnnnnK
or
REGION=nnnnM
Examples:
REGION=1024K
REGION=1M
TIME
Purpose: To specify the maximum processor time that the step can utilize.
Syntax:
TIME=(mm,ss)
m: minutes
s: seconds
TIME=MAXIMUM
13
JCL
TIME=NOLIMIT
TIME=1440
PARM
Syntax:
PARM=value
Example:
PARM='ABCDEFGH'
DD Statement
Purpose of the DD statement
Syntax
Parameters
- DSN
- DISP
- SPACE
- VOL
- UNIT
- DCB
- SYSOUT
Temporary datasets
Referbacks
Special DD names
Dataset concatenation
PURPOSE OF DD STATEMENT
14
JCL
SYNTAX OF DD STATEMENT
Example:
//DDname DD parameter,paramter,…
PARAMETERS OF DD STATEMENT
DSN
Syntax:
DSN=dataset-name
Examples:
DSN=MAINUSR.COBOL.FILE
DSN=MAINUSR.DB2.FILES(DCLGEN)
DISP
Purpose:
15
JCL
Three-fold , to specify,
Syntax:
Syntax:
Numeric value - requests allocation in terms of blocks with size specified by the
numeric value.
• Primary Quantity: Specifies the amount of initial allocation for the dataset in
terms of the unit specified.
• Secondary Quantity: Specifies the amount of additional allocation for the
dataset in terms of the unit specified once the primary quantity is exhausted.
• Directory Blocks: Specifies the Directory Blocks the dataset is to have. Any
value greater than 0 creates a PDS. Coding 0 in this parameter or skipping it
altogether creates a sequential dataset.
16
JCL
VOL
Purpose: To specify the Volume on which the dataset exists or needs to be created.
Syntax:
VOL=SER=volume-serial-number
UNIT
Purpose: To specify what type of device the dataset resides on or should be created.
Syntax:
UNIT=Generic-unit-name
or
UNIT=Unit-model-number
or
UNIT=/Machine-address
Example:
UNIT=SYSDA
DCB
Syntax:
DCB=(LRECL=nnnn,BLKSIZE=nnnn,RECFM=record-format)
LRECL - Specifies the maximum length of a record in the dataset. Values can range
from 1 to 32760 bytes.
BLKSIZE - Specifies the maximum length of a block in the dataset. Values can range
from 18 to 32760 bytes.
RECFM - Specifies the format of the records in the dataset i.e. fixed, variable,
blocked, undefined etc.
Examples:
17
JCL
DCB=(LRECL=80,RECFM=FB,BLKSIZE=8000)
OMIT DSN
DSN=&&WORK
DSN=&TEMP
1. A temporary data set is one that is created and deleted in the same job.
2. There are three ways to request the creation of a temporary data set:
• Omit the DSN. In this case the system will create temporary data set having a
44-character name. The system builds date, time, and other information into
this name to ensure the name is unique.
• Code a name beginning with && such as DSN=&&WORK. The system will
create a temporary data set having a 44-character name. The system builds
date, time, and other information into the name to ensure its uniqueness.
• Code a name beginning with & such as DSN=&TEMP. The system will create a
temporary data set with a 44-character name. The system creates a unique
name containing date, time and other information. Names prefixed by && are
preferable to those prefixed by &.
• A temporary data set is created and deleted in the same job. It cannot be
kept after the end of job.
• To avoid ambiguity use the form, DSN=&&TEMP.
• To retain the dataset even after the current step ends, the temporary dataset
has to be passed to the next step by coding PASS in the second sub-option of
the DISP parameter. If you have a Job of 3 step and you want to pass a
temporary dataset from the 1st step to the 3rd step then,
- Pass it from the 1st step to the 2nd
- Pass it from the 2nd step to the 3rd.
18
JCL
• You can use referbacks if you don't want to explicitly code the value for
parameters. Rather, you can obtain values from the same parameters in other
steps.
The presence of the '*' above indicates that a backward reference is being used Many parameters in JCL
statements can use a backward reference to fill in information. A backward reference (or referback) is a reference
to an earlier statement in the job or in a cataloged or instream procedure called by a job step.
JOBLIB Default search PDS for the load-modules in the entire Job
• In case of input datasets records will be read in from files in the same order
as specified in the concatenation i.e. start reading from the first file, once
there are no more records in the first file, continue with the second file and so
on until the last file is read. Only then will the system encounter the end-of-
file condition.
• In case of output datasets, writing will start from the first dataset. Once all
the space in the first dataset is exhausted, the next dataset in the
concatenation order will be written to and, so on.
PROCEDURES
What is a Procedure?
19
JCL
Symbolic parameters
WHAT IS A PROCEDURE?
• For jobs that you run frequently or jobs that use the same JCL, pre-code job
control statements into procedures.
• Procedures consist of one or more complete steps.
• Every procedure must be given a name.
• Procedures are invoked via the E XEC statement.
• Three benefits of using procedures:
Example:
INSTREAM PROCEDURE
• When you place a procedure in the job input stream, it is called an instream
procedure
• Instream Procedures are those which are coded in the same member which
contains the Job that uses them.
• Instream Procedures can only be used by the Jobs that contain them.
CATALOGED PROCEDURES
• JOB statements
• DD * statements
20
JCL
• DD DATA statements
• Delimiter statements('/*' followed by 78 blanks)
• Null statements('//' followed by 78 blanks)
• Non JCL statement(for example, JES or utility control statement)
CATALOGED PROCEDURES
• Using the JCLLIB statement you can specify the names of the PDSs that
contain your Procedures which the Job will be using.
• Even though JOBLIB and STEPLIB are DD names and JCLLIB is a statement,
they have similar purposes.
• Symbolic parameters are variables to hold values that can be changed when
the Procedure is called
• In the above example, A and B are the symbolic parameters. Instead of
hardcoding the values for the VOL and UNIT parameters, they have been
assigned the values contained in the symbolic parameters
(Parameter=&Symbolic-parameter-name)
• Symbolic parameter names can be a maximum of 8 characters long.
At Run-time:
UTILITIES
21
JCL
• OS/390 UTILITIES
OS/390 UTILITIES
//SYSIN DD *
22
JCL
----control statements-----
/*
//SYSIN DD DSN=MAINTEC.CTLLIB(MEM),DISP=SHR
The above example allocates a dataset named ABC.SEQ,and then copies instream
data to the dataset.
Example:
Example:
23
JCL
Example:
Example:
Example:
Example:
24
JCL
Example:
The IEBUPDTE utility is used to create,update and modify sequential datasets and
members of partitioned datasets.
Example:
Example:
25
JCL
SORT FIELDS=(21,2,CH,A)
26