You are on page 1of 55

J o b

(
L ol
C
J ntr )
o a ge
C gu
a n
L
• JCL or Job Control Language is used to
communicate with the computer’s operating
system.
• A JOB is a unit of work the computer is to
perform.
• A JOB STREAM consists of JCL
statements, programs that are to be
executed, and data that are to be processed.
The data included in the job stream are
called INPUT STREAM DATA.
JCL statements :-
• JOB statement :- The first statement in a job
stream must be a job statement whose function
is to identify the job to the system.
• EXEC statement :- The job statement is usually
followed by an exec statement. The exec
statement names the program or the procedure
that is to be executed.
• DD statement :- Following the exec statement
are the DD statements (data definition)
statements. The DD statements describe the
data used by the program.
• The other JCL statements are delimiter, null,
comment, proc & pend.
• An EXEC statement and its DD statements
make up a job step.
• A job may consist of any no. of job steps.
• The job, exec & DD statements have a common
format which
is :- //name
operation operand comments
JCL conventions on a Live
Project
• Job executes procedures, procedures have
various steps to execute various programs,
which use parameters and parameter files.
Example JCL :-
Naming conventions :-
Jobs will be held in datasets with .cntl
or .jcl extension
e.g. ORSDEVP.REL#15.JCL
Procedures will be held in datasets
with .proclib or .proc extension
e.g. ORSTEST.REL#15.PROCLIB
Parameters used will be held in datasets
with .parm or .parmlib extensions
e.g ORSLIVE.REL#1.PARMS
Parameters :-
• There are two kinds of parameters in
the operand field :- positional and
keyword parameters.
• The operating system recognizes
positional parameters by their
position in the operand field.
• Keyword parameters can be coded in
any order.
• positional parameters must be coded
in a specific order before any
keyword parameter.
Consider the job statement :-
Positional parameters :- Keyword parameters :-
- e.g.. accounting - e.g.. class & msglevel.
information & - MSGLEVEL=(1,1)
programmers name. indicates print all the input
- accounting information JCL & the JCL from
must precede the catalogued procedures &
programmers name. print all allocation
- if a positional messages.
parameter /sub - TYPRUN=SCAN causes
parameter is omitted a the job’s JCL to be checked
comma must be coded in for syntax errors & prevents
its place. the job from executing.
Controlling step execution -
the COND parameter.
• The COND parameter offers a method of testing the return
codes issued by the previous steps to determine whether a
step will be executed.
• The format of a simplified version of the COND parameter
is COND =(value,operator).
• Value is a no. between 0 and 4095 and operator could be
gt,ge,eq,ne,lt,le.
• The COND parameter causes the value entered to be tested
against the return codes from the previous steps, using the
operator provided.
• If the test condition is true,the step is skipped.If the test
condition is false,the step is executed.
Symbolic parameters :-
• Symbolic parameters offer a convenient way of changing a
procedure to fit your requirement.
• Consider the example procedure-proglod, sysctl, sym,etc.
are all symbolic parameters.
• Symbolic parameter names may consist of from one to
seven alphanumeric or national characters preceded by an
ampersand. The first character however must be
alphabetic / national.
• Exec statement keyword parameters may not be used as
names of symbolic parameters.For e.g.. &REGION. This
restriction does not extend to DD statement keyword
parameters.For e.g. &DSN can be used as symbolic
parameter.
Example procedure :-
Linkage parameter :-
• Linkage parameters are used in COBOL programs.
• Linkage parameters are passed on to the COBOL
programs through JCL by coding ‘parm=‘ parameter
in the exec statement.
• Whenever linkage parameters have to be used,
Linkage section has to be coded in the COBOL
program after the data division and the procedure
division should specify the use of linkage section.
• //DD400S01 EXEC
PGM=DD400900,PARM='&PROCTYPE&DBNME
&DICTNME'
Generation Data Groups(GDG) :-
• A generation data group is a collection,or
group,of cataloged data sets having the same
name and related to one another chronologically.
Each of these datasets is called a generation data
set or,simply, a generation.
• Each generation data set is distinguished by
others by the generation number.
• The main advantage of using a GDG is that the
same JCL can be reused without change.
• Generation group index contains information on
how many generations are to be retained and
what to do when the index gets full.
Defining a generation group
index using IDCAMS :-
• IDCAMS is the name of the access method
services utility program that performs functions
vital to the virtual storage access method(VSAM).
• IDCAMS requires a region of 300K, a SYSPRINT
DD statement for messages and a SYSIN DD
statement for control statements.
• The command format :-DEFINE GDG (PARMS).
Define GDG parameters :-
Parameter Abbrv Meaning
NAME GDD name.
LIMIT LIM The no. Of generations permitted for this gdg.
The max is 255.
EMPTY EMP If empty is specified, all data sets are to be
removed from the index when the limit is
reached.
NOEMPTY NEMP NOEMPTY is the default.

OWNER User identification (optional).

SCRATCH SCR If scratch is specified,the dataset is scratched


when the dataset is removed from the index.
NOSCRATCH NSCR NOSCRATCH is the default.

TO (date) Dataset retention period.

FOR(days) Dataset retention period.


Creating and accessing a generation :-
• The generation number may be relative or absolute.
• If the DS name in the group is
DDSNUS.DEVTDV.DD460302,
then to access the current generation,you code
DSN=DDSNUS.DEVTDV.DD460302(0).
To access the previous generation, you code
DSN= DDSNUS.DEVTDV.DD460302(-1) the generation
before would be
DSN= DDSNUS.DEVTDV.DD460302(-2).
• If you want to create a new generation, you code
DSN= DDSNUS.DEVTDV.DD460302(+1).
• The absolute no. used by the system is in the form
GXXXXVYY,where xxxx is a generation no. from
0000 to 9999 and yy is a version no. from 00 to 99.

• Thus the generation specified as DSN=


DDSNUS.DEVTDV.DD460302(0) might appear to
the system, for e.g.. ,as
DDSNUS.DEVTDV.DD460302.G0006V00. Then
the data set with a relative no. of (-1) would be
DDSNUS.DEVTDV.DD460302.G0005V00, (+1)
would be DSNUS.DEVTDV.DD460302.G0007V00.
Deleting a generation group
index using IDCAMS...
Libraries :-
• Another name for a library is a partitioned data
set(PDS).

• Libraries can be created,accessed & modified using


utility programs like
IEFBR14,IEBGENER,IEBPTPCH,IEBUPDTE,
IEBCOPY,etc.

• IEFBR14,IEBGENER & IEBCOPY are the most


frequently used utilities on any project.
IEFBR14 :-

• Strictly speaking it is not a utility program


because it does nothing. It clears register 15 and
BR(branch) 14.
• It is used to create or delete a library based on the
DD statement parameters.
• The following slide consists of an example of
IEFBR14.
IEBGENER :-
• IEBGENER uses four data sets described by
SYSPRINT, SYSIN, SYSUT1 & SYSUT2.
• SYSPRINT is the DDNAME of the data set that
IEBGENER uses to write messages.
• SYSIN is the DDNAME of the data set that
contains the control statements to tell IEBGENER
how the input data set should be modified while it
is being copied.
• SYSUT1 is the DDNAME of the input data set that
IEBGENER is to copy.
• SYSUT2 is the DDNAME of the output data set
that is to be created.
Example of IEBGENER :-
Note :-
• The SYSOUT parameter :- sysout is a keyword
parameter that assigns a data set to an output
class.
• The DUMMY parameter :- The sysin DD
statement in the example contains the parameter
dummy. Dummy is a positional parameter that
indicates that the data set is not to be processed.
• The * parameter :- The * is a positional
parameter that indicates that input stream data
follow immediately after the DD statement (if
coded after sysut1 DD statement.). The delimiter
statement, which has /* in column 1 & 2, indicates
the end of input stream data.
Note :-
• Specifying ddnames in a program :-
In a COBOL program the DDNAME is
specified in the ASSIGN clause: ‘SELECT
SALEFILE ASSIGN TO SALES’. The DD name
would then be //sales DD ....
• Temporary data set :- A temporary data set name
consists of two ampersands(&&) followed by an
unqualified data set name.
IEBCOPY :-
• IEBCOPY is a utility program that may be used to
copy one or more members from an existing PDS
to a new or existing PDS, to make a backup copy
of a PDS, and to reorganize a PDS in order to
reclaim the unused space
DFSORT using JCL :-
• Sorting means putting records in a data set into a
specified order.
• Merging is closely related to sorting;it means
combining records from two or more sorted
datasets into one data set that is in the same
order.
• The sort program requires three pieces of
information:where to find the input data,which
fields in the records to do the sorting on, and
where to put the sorted output data set.
Example of DFSORT :-
• The sort program expects its input to be supplied
under the DDNAME SORTIN and writes its
output under the DDNAME SORTOUT.
• The DD statements SORTWK01 through
SORTWK06 provide work areas for the sort
program.
• Sort program uses SYSOUT DD statement for
messages.
• SYSIN DD statement defines the control statement
data set.
Sort control statements :-
The most commonly used sort control statements are
SORT and MERGE.
• A typical control statement would look like :
SORT FIELDS=(1,10,CH,A).
• The syntax for the fields parameter is
FIELDS=(position,length,format,sequence...) or
FIELDS=(position,length,sequence...),
FORMAT=format.
• Position is the starting byte of the control field in the
record. Length is the length in bytes of the control field.
Format is the format of the data in the control field.
• Commonly used values for format are ZD for
zoned decimal, PD for packed decimal, BI for
binary, AC for ASCII character, CH for EBCDIC
character, AQ for EBCDIC character using
alternative collating sequence.
• Sequence is either A for ascending or D for
descending.
• The include & omit statements : The include &
omit statements are used to select the records to
be included in the sort. By selecting records for
the sort, you can decrease the amount of time the
sort requires.
• Only one include or omit statement is permitted in
a sort. The syntax is include cond=(test) & omit
cond=(test)
• The only difference between include & omit is in
the result. If test coded with include is true for a
particular record,that record is included in the
sort;whereas if test coded with omit is true,that
record is omitted from the sort.
• In either case test is coded as follows :
test=(position,length,format,operator,value)
• The position,length & format sub parameters
specify a field in the record,just as in sort fields
parameter.
• The operator sub parameter may be
GT,GE,EQ,NE,LT & LE.
• The last sub parameter, value, may be either a
field in the record-specified by its own position,
length & format, or a constant.
• Numeric constants are coded as simple values,
such as 15 or -20. Character constants are
enclosed in apostrophes and preceded by a c,as in
c’dec’. Hexadecimal constants are enclosed in
apostrophes and preceded by an x,as in x’f1f2c3’.
• If more than one test is coded, the tests are joined
by the boolean operator AND or OR..
• A typical include statement would look like :
INCLUDE COND=(29,1,CH,EQ,C’L’)

The INREC & OUTREC statements :


These statements are used to reformat the records.
• The INREC statement is used before sort to
shorten the records by eliminating unwanted
fields. This results in faster sorting.
• The OUTREC statement is used after the sort to
improve readability.
• INREC & OUTREC have identical formats:
INREC FIELDS=(nX,position,length,align,...)
OUTREC FIELDS=(nX,position,length,align,...)
• The first sub parameter,nX,is optional; it specifies
the no. of spaces to be inserted in the reformatted
record.
• The next two parameters, position & length,
specify the field in the input record.
• The third sub parameter, align, is optional; the
possible values being H, F, and D specify
alignment on a half-word, full-word, and double-
word boundary respectively.
Merging :-
• When you merge, you start with two or more
sorted data sets and create a new data set that is
in the same sorted order.
• While merging you must specify more than one
input data set. These data sets have the DD names
SORTINnn, where nn may range from 01 to 16.
• SKIPREC & EQUALS / NOEQUALS options are
not used on the merge statement.
• The sort control statements are normally coded in
a parameter file.
Example of sort control statements :-
VSAM Data sets :-
• There are three types of VSAM data sets : key
sequence data sets,entry sequence data sets, and
relative record data sets.
• For VSAM data sets, unlike non-vsam data sets, a
utility program, IDCAMS is used to perform
functions like :
- Allocating space on DASD
- Supply description of the data set

- Set the data set’s disposition -


Load the data set -
Print the data set
• DEFINE CLUSTER is the command using which
all the descriptive information about the VSAM
data set is supplied.

• REPRO command may be used to load data into a


VSAM data set.

• PRINT command is used to obtain a listing of a


VSAM data set.

• FILE-AID utility from ISPF primary menu(v.1)


can be used to allocate / manage VSAM data sets.
Example of defining cluster :-

You might also like