Professional Documents
Culture Documents
LANGUAGE(JCL)
Objectives
• Focus of this course is to effectively convey the JCL concepts and
fundamentals
• Intended to provide the benefits.
– Competence with the tools and utilities used
with JCL
– Ability to setup and execute jobs successfully
Expectation
It’s a 7 unit training course designed to demand approximately 9
hrs
of training time
Prerequisites
• Basic knowledge of mainframe concepts
• Dependency
• This course is intended to be after TSO/ISPF and Cobol sessions
and before VSAM session.
Course Outline
MODULE1
• Introduction - Job Control
Language
• Basic Terminology & JCL
Statement Format
• Positional vs Keyword Parameters
• Relationship of Job Control
Language to the operating system
Course Outline (Contd)
MODULE2
• Job statement
• Positional Parameters in JOB statement - Accounting & Programmer
• Keywords Parameters on the JOB statement - MSGLEVEL,
MSGCLASS, CLASS
• MSGLEVEL
• MSGCLASS
• NOTIFY
• TIME
• REGION
• RESTART
• TYPRUN
Course Outline (Contd)
MODULE 3
• Basic Terminology & JCL statement format
• Positional Parameters - PGM, PROC
• Keywords Parameters -TIME,REGION
• Parameters -PARM
MODULE 4
• DD Statement
• Positional Parameters on DD Statement
• Keyword Parameters - DSN, DISP, DCB
• Keyword Parameters- VOL,LABEL,UNIT
• SPACE Parameter
Course Outline(Contd)
MODULE 5
• IBM Utilities
• System Utility Programs
• DataSet Utility Programs
• Independent Utility Programs
MODULE 6
• Concatenation of Dataset & Rules
• Temporary Dataset
• Referbacks
• Special DD Statements-JOBLIB &STEPLIB Statements
• JCLLIB Statements
Course Outline(Contd)
• Symbolic Parameters
• SET & Special DD names
• INCLUDE Statement
MODULE 7
• Catalogued Procedures
• Instream Procedures
• Modifying Procedures
MODULE 8
• Keyword Parameter=COND
• Commonly Occuring Abend Codes
• IF/THEN/ELSE/ENDIF Statement
• Operators
Course Outline(Contd)
MODULE 9
• Uses of GDG
• Define a GDG
• Delete a GDG
MODULE 10
• JES2 Control Statements
• JES3 Control Statements
MODULE 11
• DFSORT
References
• MVS JCL by Doug Lowe
• IBM Job Control Language Course notes
• MVS JCL Primer by Saba Zamir & Ranade
• www.mvshelp.com
MODULE 1
Introduction - Job Control
Language
• Job Control Language is the means of communication between an
application program and the computer's operating system (the IBM
OS 390 MVS Operating System). JCL carries specific orders
through control statements.
• What Can I Do With JCL?
– submit a job to the operating system
– request resources needed to run the job
– control the system’s processing of the job
• What is needed to Write JCL?
– access to the IBM mainframe computer
– a valid TSO user ID
Introduction - Job Control
Language (Contd)
• Functions of JCL
– It identifies your Job to the system.
– It describes the Job’s requirements.
– It directs the execution of the program(s)
– It describes the devices(readers,printers etc.) and
resources(datasets) needed by the program(s).
– JCL statements provide information that the operating system
needs to execute a job
– A job is something that you want to accomplish with the aid of a
mainframes, e.g. copy a data set, execute a program, or process
multiple job steps. You need to supply the information that the
job requires and instruct the computer what to do with this
information. You do this with JCL statements
Basic Terminology and JCL
statement Format
• JCL Statement Format
– Job Control Language (JCL) is very precise. It has specific rules
of grammar and syntax that must be followed. JCL must not
contain any irregularities. The JCL will be rejected if it contains
typographical errors (including extra or missing spaces or
commas), fields in the wrong order, etc. JCL and JES2
statements (except for comments) must not contain lower case
letters.
Basic Terminology and JCL statement
Format(Contd)
• BASIC TYPES OF JCL STATEMENTS
– JOB STATEMENT :Provides accounting information as well as job
name to each job.
– EXEC STATEMENT: calls specified program or procedure for
execution.
– DD STATEMENT:provides details about the various resources used
by the program.
– COMMENT STATEMENT: The comment statement contains
comments. It is used primarily to document a program and its
resource requirements.
– DELIMITER STATEMENT: The delimiter statement signifies the end
of a job step.
– NULL STATEMENT: The null statement signifies the end of a job.
JCL statement Format(Contd)
• JCL Parameter Fields
– Each Job Statement is logically divided into:
• Identifier Field
• Name Field
• Operation Field
• Parameter Field
• Comment Field
Job Control Language Format
Identifier Field
Name Field
(Contd)
Operation Field
Parameter Field
• Positional Parameters:
– Must be first and in specific order.
– Absence must be indicated by comma.
– If last one is absent no comma necessary.
– If all later ones absent no commas necessary.
– If all positional parameters absent no commas necessary.
• TIME=(5,0) is not necessary TIME=(5) is enough
• TIME=(,30) is same as TIME=(0,30) but TIME=(30) is not
correct.
Positional vs Keyword Parameters
• Keyword Parameters
– Appears after positional parameters.
– Can be in any order with respect to one another.
– Need not indicate the absence of a keyword parameter.
– Below statements are valid
• //NAME OPERATION K1=A,K2=B
• //NAME OPERATION K2=B,K1=A
SAMPLE JCL CODE
//L110 JOB (00124,'MONTHLY STATISTICS'),
// CLASS=P,MSGCLASS=P,REGION=0M
//JOBLIB DD DSN=IPHP.DUMMY,DISP=SHR
// DD DSN=IPHP.BT.PGMLIB,DISP=SHR
// DD DSN=IPHP.OL.PGMLIB,DISP=SHR
// DD DSN=IMSS.RESLIB,DISP=SHR
//LST11008 EXEC
LST11008,ENV=IPHP,UNITDA=PRODDA,CTL=IPHP
//LST11018 EXEC LST11018,ENV=IPHP,UNITCT=CART,CTL=IPHP,
// UNITDA=PRODDA
//LST11020 EXEC LST11020,ENV=IPHP,UNITCT=3490,
// UNITDA=PRODDA
MODULE 2
JOB statement
• The Job statement names a job, supplies accounting and billing
information, and supplies options to control processing of the
job.
• The JOB statement is always your first JCL statement. It
signals the beginning of a job and the end of any previous job
and assigns a name to your job.
//L116 JOB (00124,‘PROGRAMMER NAME'),
// CLASS=J,MSGCLASS=Z,REGION=0M,MSGLEVEL=(0,0),
// NOTIFY=&SYSID,TIME=(2,30),TYPRUN=SCAN,RESTART=STEP2
• The JOB card requires
the Jobname, which appears on the header page of your
output,
the word JOB in the Operation field,
the accounting information for your job,
the programmer's name.
Positional Parameters in JOB statement -
Accounting & Programmer
• Programmer Name
– The PROGRAMMER name can be a maximum of 20 characters.
Keyword Parameters in JOB statement –
CLASS,MSGCLASS,MSGLEVEL
• Operation Field:
– This field consists of characters EXEC and can start in any
column.
– The word EXEC must be preceded and followed by a blank.
EXEC Statement (Contd)
• Comment field:
– The comments field follows the parameter field after at least one
intervening blank.
• Parameter field:
– EXEC statement has 2 types of parameter fields.
• Positional Parameter Field
• Keyword Parameter Field.
Positional Parameters
• The two positional parameter of EXEC statements are:
– PGM
• It refers to a program name or a procstepname.
• The program name must be 8 characters long.
– PROC or Procedure name
• It refers to procedure name.
Positional Parameters (Contd)
• PGM parameter:
– It is used to name the program that the system is to execute.
– Coded as first parameter in EXEC statement.
– The specified program must be a load member of a partitioned
data set (PDS) used as a system library, a private library, or a
temporary library.
– PGM=program-name
• Program name specifies the member name or the alias of the
program to be executed.
Positional Parameters(Contd)
– The system passes MT5 to the first step of the procedure named
PROC81. If PROC81 contains more steps and their EXEC
statements contain PARM parameters, the system nullifies those
PARM parameters.
• //EXEC PROC=PROC81,PARM=MT5
Exercises
1.What is the error in the following JCL statements
i)//step#three exec pgm=hkbc762
ii)//step#3 exec pgm=hkbc762
iii)//step#3 exec pgrm=hkbc762
• //DDSMS1 DD DSNAME=ALPHA.PGM,
//DISP=(NEW,KEEP),DATACLAS=DCLAS1,
//MGMTCLAS=MCLAS1,STORCLAS=SCLAS1
– DD statement DDSMS1 defines a new SMS-managed data set
and names it ALPHA.PGM. DD statements in later job steps or
jobs may retrieve this data set by specifying ALPHA.PGM in the
DSNAME parameter.
Keyword Parameters on DD
Statement (Contd)
• DISP :
– Used to instruct the system as to the current status of a data set
– It also indicates the steps to be taken with the dataset upon
successful or unsuccessful execution of a Job
– Syntax DISP=(status,normal-disposition,abnormal-disposition)
• status - indicates current status of dataset
– NEW – the dataset does not exist and should be created
– OLD – the dataset exists and should be allocated for
exclusive use
– SHR – the dataset exists and should be allocated for shared
use
– MOD – the dataset is allocated for exclusive use and is
positioned at the end of the data, so additional records may
be added after last record
Keyword Parameters on DD
Statement (Contd)
• normal-disposition – specifies how the dataset is to disposed upon
normal execution of job
– DELETE – the dataset is deleted . If the dataset was retrieved
from catalog, it is also uncataloged
– KEEP – the dataset is retained
– CATLG – the dataset is retained and catalog entry is made
– UNCATLG – the dataset is retained but it’s catalog entry remove
– PASS – Normal disposition only. The dataset is retained for use
by a later job step
• abnormal-disposition – specifies how the dataset is to be disposed
upon abnormal execution of job
– DELETE – the dataset is deleted . If the dataset was retrieved
from catalog, it is also uncataloged
– KEEP – the dataset is retained
– CATLG – the dataset is retained and catalog entry is made
– UNCATLG – the dataset is retained but it’s catalog entry remove
Keyword Parameters on DD
Statement (Contd)
– MVS assumes default values for DISP parameter
• If status subparameter is omitted MVS assumes it as NEW
• If normal-disposition subparameter is omitted the default
depends on the status subparameter
– If status subparameter is NEW the normal disposition
subparameter is DELETE else KEEP
• If abnormal disposition subparameter is omitted it takes
whatever value specified in normal disposition subparameter
– DISP=SHR – Allocates an existing dataset for shared access,
normal and abnormal disposition parameter default is KEEP
Keyword Parameters on DD
Statement (Contd)
– DISP=OLD – allocates an existing dataset for exclusive access,
normal and abnormal disposition default set to KEEP
– DISP=MOD – if dataset exists, extend it else create it. The
access is exclusive, normal and abnormal disposition default is
set to KEEP
– DISP=(NEW,CATLG) – allocates a new dataset and catalogs it,
abnormal disposition set to CATLG
– DISP=(OLD,DELETE) – allocates and exiting dataset and
deletes it , abnormal disposition set to DELETE
– DISP=(,KEEP,DELETE) – allocates a new dataset and keeps it if
job step ends normally, if job step ends abnormally the dataset is
deleted
– DISP=(NEW,CATLG,DELETE) – the dataset is created,
cataloged if the job step ends normally and deletes it if job step
ends abnormally
Keyword Parameters on DD
Statement (Contd)
• DCB Parameter:describes the dataset.
– //DD1A DD
DSNAME=EVER,DISP=(NEW,KEEP),UNIT=3380,
– //
DCB=(RECFM=FB,LRECL=326,BLKSIZE=23472),
– // SPACE=(23472,(2 ,4 ))
• DD statement DD1A defines a new data set named EVER on a
3380. The DCB parameter contains the information necessary to
complete the data control block.
Keyword Parameters on DD
Statement (Contd)
• Important subparameters of DCB parameter:
• BLKSIZE : specifies the number of bytes (characters) per
block,where b is a multiple of the LRECL.
• LRECL : specifies the logical record length (n) for fixed or variable
length records; omit LRECL for records of undefined length.
Keyword Parameters on DD
Statement (Contd)
• RECFM : specifies the record format. Common values for RECFM
are
– U for undefined-length records,
– V or VB for variable-length or variable-blocked records,
– F or FB for fixed-length or fixed-blocked records, and
– FA, FBA, or VBA for fixed, fixed-blocked, or variable-blocked
records with a printer control character as the first byte of data.
Keyword Parameters on DD
Statement (Contd)
• UNIT :
– It specifies whether the dataset is to reside on disk or tape; device can be
DISK for disk datasets, TAPE for cartridge tape datasets, or REEL for
reel (round) tape datasets.
• UNIT= [device_address]
– Each I/O device is assigned a hardware address when a system is
generated
– Device address is expressed as a three/four hexadecimal digits
• //JOB1 JOB A123,’NAME’
• //STEP1 EXEC PGM=PGM1
• //DATA1 DD DSN=FILE1,
• // UNIT=S04
– Here when the Job is executed PGM1 is executed and a dataset
called FILE1 which resides on a device identified by its hardware
address S04 is accessed
Keyword Parameters on DD
Statement (Contd)
• UNIT= [device_type]
– Device type is identified by the model number assigned to that device
by IBM.
– It is installation specific
• //JOB2 JOB A124,’NAME’
• //STEP1 EXEC PGM2
• //DATA1 DD DSN=FILE2,
• // UNIT=3390
– Here when the JOB2 is submitted PGM2 is executed and a
dataset called FILE2 which resides on a 3390 disk unit is
accessed
Keyword Parameters on DD
Statement (Contd)
• UNIT=[device_group_name]
– Device group name is symbolic name which is assigned to a
group of devices when system is generated
– Devices are grouped together based on their functions
• //JOB3 JOB A125,’NAME’
• //STEP2 EXEC PGM=PGM3
• //DATA2 DD DSN=FILE3,
• // UNIT=TESTDA
– Here when JOB3 is submitted PGM3 is executed which
accesses FILE3. The file can reside on any of devices
which are grouped under symbolic name TESTD
Keyword Parameters on DD
Statement (Contd)
• UNIT=[device,DEFER]
– It defers the mounting of volume that UNIT references, until
dataset that resides on it is opened
• //JOB4 JOB S123,’NAME5’
• //STEP2 EXEC=PGM4
• //NAME DD DSN=DATA3,
• // UNIT=(TAPE,DEFER)
– Here when JOB4 is submitted, PGM4 is executed. The
dataset UNIT parameter along with DEFER
subparameter is used to specify that dataset resides on
TAPE and tape need not be mounted until system
specifically requests it.
Keyword Parameters on DD
Statement (Contd)
• UNIT=[AFF=ddname]
– AFF subparameter is used to reference a device that specified in
a prior DD statement
– AFF stands for affinity
– Advantage is AFF subparameter forces datasets into same
device and thus saving storage space on available I/O devices
• //JOB1 JOB D13,KIRAN
• //STEP1 EXEC PGM=PGM1
• //NAME1 DD DSN=DATA1
• // UNIT=CART
• //NAME2 DD DSN=DATA2
• // UNIT=AFF=NAME1
– Here the datasets NAME1 & NAME2 resides in the same
unit.
Keyword Parameters on DD
Statement (Contd)
• VOL parameter
– Specifies the volume on which the dataset resides; name is either a disk
pack or a tape name.
– This parameter can be omitted for an existing catalogued data set.
• VOL=SER
– This is used to request specific volumes
• //JOB1 JOB D12,’GIREESH’
• //STEP1 EXEC PGM=PGM1
• //NAME1 DD DSN=DATA1,
• // VOL=SER=23456
• VOL=REF subparameter
– This is used to specify a volume which has been previously defined
within same Job, but not in current step
– VOL=REF=*referback
Keyword Parameters on DD
Statement (Contd)
//JOB1 JOB C123,’JANNET’
//STEP1 EXEC PGM=PGM1
//DD1 DD DSN=DATA1,
// VOL=SER=VOL1
//DD2 DD DSN=DATA2,
// VOL=REF=*.STEP1.DD1
Here when the Job is submitted the program PGM1 is
executed the dataset DD1 is accessed from volume
whose serial number is VOL1. The reference is again
made to same volume number in DD2 via the Reference
sub parameter.
Keyword Parameters on DD
Statement (Contd)
• Space parameter:
– Used to specify the storage requirements on direct access devices
– Syntax SPACE= (CYL,(primary,secondary,directory),RLSE)
= (TRK,(primary,secondary,directory),RLSE)
= (BLK,(primary,secondary,directory),RLSE)
– primary – specifies how many units of space to allocate for the
dataset’s primary extents.
– secondary – if the file requires space more than what is allocated in
primary extent, secondary extents can be used to allocate upto 15
times.
– directory – this is used only for partitioned datasets
• this is used to record the names and locations of members
created within partitioned datasets
• It should be a number that specifies how many 256-byte blocks
are to be contained in the directory of a PDS
Keyword Parameters on DD
Statement (Contd)
• RLSE –
– It specifies that any unused space is to be released when the job
step is finished with the data set.
• This parameter is optional; it should be coded for sequential
data sets only.
• Example
– SPACE=(TRK,(20,5),RLSE)
– The maximum space that could be allocated is: 20 + 5(15) = 95
tracks.
Exercises
1.Write a DD statement for creating a new dataset with the following
features
1.The dataset should be deleted once the step completes
2.The dataset should be deleted once the step abends
3.It should be sequential dataset with primary and
secondary allocation of 2 blocks each.
4.The unused space should be freed once the step finishes
5.The logical record length be 80,block size of 800
and record format as FB
Exercises(Contd)
2.Write a DD statement for creating a new dataset with the following
features
1.The dataset is to be kept at the end of step
2.The dataset is a partitioned dataset and it is to reside on the tape
3.Specify a primary allocation of 10 blocks and secondary allocation
of 5 blocks
MODULE 5
IBM UTILITIES
• What is a Utility?
– A set of used and tested programs that perform a variety of useful
functions.
– Assist in organizing and maintaining data.
– Examples of uses of Utility Programs:
• Copy files from one storage medium to another (e.g. card to
disk, tape to print).
• Back up and restore disk-packs.
• Catalog, scratch or rename files.
• Copy and compress partitioned data sets and so on.
• Utility programs are controlled by two types of statements
– JCL statements
– UTILITY statements
IBM UTILITIES (Contd.)
• Each Utility program falls into one of the three classes
– System Utility Programs
– Data set Utility Programs
– Independent Utility Programs
• The selection of a specific utility program is dependent on the nature
of the job to be performed.
System Utility Programs
• System Utility Programs
– Used to maintain and manipulate system and user data
– Maintain libraries and catalog entries
– Initiate volumes
– Volume and data set backup
– List VTOC, directories and catalog.
• Examples :
– A System Utility Program can be used to rename a data set.
– It can also be used to move or copy collections of data.
System Utility Programs(Contd.)
• System Utility Programs (starts with IEH)
– IEHATLAS
– IEHINITT
– IEHLIST
– IEHMOVE
– IEHPROGM
– IEHSTATR
Dataset Utility Programs
• Data set Utility Programs
– Used to reorganize, change or compare data (data set or record level)
– Allows to manipulate PDS/ SEQ data sets (fields within a logical record
to entire data sets)
– Controlled by JCL and utility statements
– The programs are executed as jobs
• Examples:
– Data set Utility Programs can be used to compare records in
sequential or partitioned data sets.
– They can also be used to copy, compress or merge partitioned data
sets.
Dataset Utility Programs(Contd.)
• Data set Utility Programs (starts with IEB)
– IEBCOMPR
– IEBCOPY
– IEBDG
– IEBEDIT
– IEBGENER
– IEBIMAGE
– IEBISAM
– IEBPTPCH
– IEBUPDTE
Dataset Utility
Programs(Contd.)
• IDCAMS UTILITY
– IDCAMS, also known as Access Method Services, is used to
perform the following tasks:
• Create a VSAM data set, VSAM alternate index, or catalog
• List a catalog entry for a data set, file/catalog contents
• Copy a file or catalog
• Print all or part of a data set in character or hex format
• Build a backup copy of a VSAM data set, catalog, non-VSAM
data set, or an alternate index
• Convert non-VSAM to VSAM data set, VSAM to SAM format,
CVOLs to ICF catalogs, VSAM catalog entries to ICF catalog
entries
• Alter the attributes of a catalog or data set
• Catalog or Uncatalog VSAM/non-VSAM data set and GDGs
Dataset Utility
Programs(Contd.)
• Verify a VSAM data set's software end-of-file indicator.
• Delete a VSAM or non-VSAM data set or volume records,
catalog, path, GDG, alias, candidate volume, alternate index,
page space, or truename catalog entry
• Attach a user catalog to the master catalog
• Create a MVS paging space, generation data group (GDG)
• Collect data set and volume info. on migration utility
• Connect catalogs to one another
• Import/Export VSAM data sets, catalogs
• Load a VSAM file from SAM, ISAM, or VSAM records
• Unload a VSAM data set
• Merge ICF catalogs or recreate ICF entries
• Rename VSAM data sets
• Move a catalog and VSAM/non-VSAM data sets
Dataset Utility Programs
(Contd.)
• Sample IDCAMS JCL:
//JS10 EXEC PGM=IDCAMS,REGION=1024K,PARM=parameters
control statements...
/*
Dataset Utility
Programs(Contd.)
• Sample JCL to copy one file to another file:
//JS10 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MY.DSN.IN,
// DISP=SHR
//SYSUT2 DD DSN=MY.DSN.OUT,
// DISP=(,CATLG),
// VOL=SER=volser,
// SPACE=(TRK,(30,30),RLSE)
//SYSIN DD DUMMY
//SYSUDUMP DD SYSOUT=*
Dataset Utility
Programs(Contd.)
• IEBCOPY:
– IEBCOPY is a generalized copy utility used to perform the following
tasks:
• IEBCOPY is used to copy all or part of a Partitioned Data Set (PDS)
or PDSE. Selected members of a PDS or PDSE can be copied to
another or the same PDS or PDSE and/or renamed.
• A sequential backup copy of a PDS or PDSE can be made. A PDS
or PDSE can be refreshed from a sequential copy previously
created by an unload. You can load a PDS to an SMS managed
PDSE. Copying a PDSE to a PDS can be done, but application
information stored in the directory of the PDSE will be lost. Altering
RLD counts for load modules in place can also be done
• Is used to "compress" a PDS when all of its unused internal space
has been exhausted. The compress operation reorganizes a PDS
so that all previously unused space inside the PDS is reclaimed. .
Dataset Utility
Programs(Contd.)
• Sample IEBCOPY JCL:
//JS10 EXEC PGM=IEBCOPY,REGION=1024K,
// PARM='SIZE=nnnnnnnnK' Optional PARM
//SYSPRINT DD SYSOUT=* IEBCOPY Messages
//ddname1 DD DSN=...,DISP=... Input File
//SYSPRINT DD SYSOUT=*
//I1 DD DSN=my.pds, same PDS for I1 & O1
// DISP=OLD
//*
//O1 DD DSN=my.pds,
// DISP=OLD
//SYSIN DD *
COMP1 C O=O1,I=((I1,R))
Dataset Utility
Programs(Contd.)
• Sample JCL to unload a PDS to a tape:
//STEP1 EXEC PGM=IEBCOPY,REGION=1024K
//SYSPRINT DD SYSOUT=*
//I1 DD DSN=my.pds, PDS to unload
// DISP=OLD
//*
//O1 DD DSN=my.pds.tape.copy, tape to unload PDS to
// DISP=(,CATLG),
// UNIT=TAPE,
// VOL=SER=
//SYSIN DD *
COPY1 C O=O1,I=((I1,R))
Dataset Utility
Programs(Contd.)
• Sample JCL to copy 4 members from one PDS to another:
//PDSCOPY EXEC PGM=IEBCOPY,REGION=1024K
//SYSPRINT DD SYSOUT=*
//I1 DD DSN=my.pds.input, copy from here
// DISP=SHR
//*
//O1 DD DSN=my.pds.output, to here
// DISP=SHR
//SYSIN DD *
COPY1 C O=O1,I=((I1,R))
SELC1 S M=MEMBER1,MEMBER2
SELC2 S M=((MEMBER3,NEWMEM3),MEMBER4) rename MEMBER3 to
NEWMEM3
Dataset Utility
Programs(Contd.)
• IEBCOMPR :
• IEBCOMPR is a data set utility used to compare two sequential
data sets, two partitioned data sets or two PDSEs at the logical
record level to verify a backup copy.
• Fixed, variable, or undefined records from blocked or unblocked
data sets or members can also be compared.
• Should not use IEBCOMPR to compare load modules.
• Two sequential data sets are considered equal, that is, are
considered to be identical, if:
– The data sets contain the same number of records.
– Corresponding records and keys are identical .
Dataset Utility
Programs(Contd.)
• Two partitioned data sets or two PDSEs are considered equal if:
– Corresponding members contain the same number of records
– Note lists are in the same position within corresponding
members
– Corresponding records and keys are identical
– Corresponding directory user data fields are identical
Dataset Utility
Programs(Contd.)
• Sample JCL to compare Two Partitioned Data Sets
//DISKDISK JOB ...
//STEP1 EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSNAME=PDSSET1,UNIT=disk,DISP=SHR,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000),
// VOLUME=SER=111112
//SYSUT2 DD DSNAME=PDSSET2,UNIT=disk,DISP=SHR,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=2000),
// VOLUME=SER=111113
//SYSIN DD *
COMPARE TYPORG=PO
/*
Independent Utility
Programs(Contd.)
• Independent Utility Program
– Used when the operating system is not available
– Load the universal character set buffer and the forms control buffer for a
printer
– Controlled only by the utility statements
– The programs are not invoked by calling a program
• Examples:
– Independent Utility Program can be used to initialize a direct access
volume and to assign alternate tracks.
– They can also be used to dump and restore the data contents of a direct-
access volume
• Independent Utility Program (starts with ICA)
– ICAPRTBL
Independent Utility
Programs(Contd)
Utility Control Statement Coding Rules
LISTVTOC DSNAME=dsname, x
VOL=device=serial, FORMAT
(COL.16)
UTILITIES (Contd.)
• Utility Control Statement Coding Rules
– Utility Control Statement do not start with a //
– Must be coded in columns 4 through 71
– If the statement exceeds col.71, then use the continuation rules
– Continuation rules
– Break the statement at a comma
– Code a nonblank character in col.72
– Continue the statement in col.16 of the following line
– The utility control statement is coded right after the //SYSIN DD
statement.
//SYSIN DD *
( the word DATA may be used instead of the * )
UTILITIES (Contd.)
– Utility Control Statement Coding Rules
• The utility control statement may also be coded as a
sequential data set or a member of a PDS on the //SYSIN DD
statement
//SYSIN DD DSNAME=TSOI044.CNTL,DISP=SHR
//SYSIN DD DSNAME=TSOI044.CNTL(member),DISP=SHR
• The utility control statement may also be coded as a DUMMY
data set if no editing is required. DUMMY may be coded when
using IEBGENER
• The abbreviation DSN for DSNAME is not accepted in the
utility control statement. You must always code DSNAME
• VOL=device=serial field in the utility control statement. Here,
device is the same as unit=device in the DD statement. The
serial is the same as the VOL=SER=serial in the DD
statement.
Exercises
1.Write down the JCL code for moving “WELCOME TO USSWI” to a
dataset ABC.DFG.SEQ
2.Assume that the above dataset is a partitioned dataset move the
above
data to its member.
3.Write down the JCL code for renaming and deleting 2 members of a
dataset ABC.SDE.DEL
4.Write down the JCL code for copying 4 members of the dataset
ABC.SDE.DEL to ADS.MER.NEW
MODULE 6
Concatenation of Datasets & Rules
Concatenation is the grouping a set of separate datasets into a single
logical dataset
Rules of Concatenation
1.Maximum of 255 sequential datasets
2.Maximum of 16 partitioned datasets
3.Partioned and sequential datasets cannot be mixed
4.Members of a partitioned datasets are treated as sequential datasets
5.RECFM must be the same on each data being concatenated
6.Coding rules specify that the ddname to be omitted after the first
dataset to be concatenated
Temporary Dataset
A Temporary Dataset is one that is created and deleted
in the same job.There are three ways of creating a temporary dataset
1.Omit the DSN
//A DD UNIT=SYSDA,SPACE=(TRK,1)
2.Code the name with && such as DSN=&&WORK
3.Code the name with & such as DSN=&&WORK
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
Referbacks
Refeback or backward reference is used to obtain the values
from the same parameters in other steps.The presence of *
indicates that referback is being used.
Example:-
//STEP1 EXEC…..
//DD1 DD DSN= A.B.C,….
//STEP2 EXEC ……..
//DD2 DD DSN=*.STEP1.DD1
Special DD Statements
• Use special DD statements to specify private catalogs, private
libraries, and data sets for storage dumps and checkpoints
• Some of the special DD statements are JOBLIB, STEPLIB, JCLLIB,
SYSOUT, SYSIN, SYSPRINT
JOBLIB & STEPLIB
• JOBLIB statement:
– Identifies a private library that the system is to search for the
program named in each EXEC statement PGM parameter in the
job.
– Only if the system does not find the program in the private
library, does it search system libraries.
– Syntax //JOBLIB DD parameter [,parameter ]...[comments ]
– The JOBLIB DD statement must immediately follow the JOB
statement
– There must be no intervening EXEC or other DD statements
between the JOB statement and the JOBLIB statement.
JOBLIB & STEPLIB(Contd)
– The JOBLIB statement must precede the EXEC statement
– If its location is cataloged, it must specify the unit and volume
serial number of device containing the program to be executed
– We can concatenate job libraries
• Code a JOBLIB statement
• Follow this statement with DD statements that define other
private libraries. Omit a ddname for these subsequent DD
statements
– Do not include a JOBLIB DD statement in an in-stream or
cataloged procedure.
JOBLIB & STEPLIB(Contd)
//JOB1 JOB A123,’BHASKAR’
//JOBLIB DD DSN=M1.TEST.LOADLIB,
// DISP=SHR
//STEP1 EXEC PGM=PGM1
//STEP2 EXEC PGM=PGM2
– Here both the programs PGM1 & PGM2 exists in library
M1.TEST.LOADLIB
//JOB2 JOB A124,’ANNA’
//JOBLIB DD DSN=PROGRAM1,
// DISP=SHR,UNIT=333,
// VOL=SER=PACK1
– Here both UNIT and VOL subparameters are included as
PROGRAM1 is uncataloged
JOBLIB & STEPLIB(Contd)
//L140 JOB (00124,'PURGE PGM'),
// CLASS=N,MSGCLASS=P,TIME=1440,REGION=6M
//JOBLIB DD DSN=IPHP.BT.PGMLIB,DISP=SHR
// DD DSN=IPHP.OL.PGMLIB,DISP=SHR
// DD DSN=SYS5.PROSERV.EXITS,DISP=SHR
// DD DSN=S00P.BT.PGMLIB,DISP=SHR
// DD DSN=S00P.OL.PGMLIB,DISP=SHR
JOBLIB & STEPLIB(Contd)
• STEPLIB statement:
– Create a private library.
– Identify a private library that the system is to search for the
program named in the EXEC statement PGM parameter.
– If the system does not find the program in the private library,
only then does the system search the system libraries.
– Syntax //STEPLIB DD parameter [,parameter ]...[comments ]
– Overriding a JOBLIB
• If the system lib is defined in a STEPLIB DD statement then
the system will ignore the JOBLIB DD statement for that
step.
JOBLIB & STEPLIB(Contd)
• //PAYROLL JOB BAKER,MSGLEVEL=1
• //JOBLIB DD DSNAME=LIB5.GROUP4,DISP=(OLD,PASS)
• //STEP1 EXEC PROC=SNZ12
• //STEP2 EXEC PGM=SNAP1
• //STEPLIB DD DSNAME=LIBRARYP,DISP=(OLD,PASS),
• // UNIT=335 ,VOLUME=SER=55566
• //STEP3 EXEC PGM=A153
• //STEP4 EXEC PGM=SNAP11
• //STEPLIB DD DSNAME=*.STEP2.STEPLIB,
• // DISP=(OLD,KEEP)
– The system searches LIBRARYP for program SNAP10; LIBRARYP is
passed to subsequent steps of this job. The STEPLIB DD statement in
STEP4 refers to the LIBRARYP library defined in STEP2; the system
searches LIBRARYP for SNAP11. Since a JOBLIB DD statement is
included, the system searches for programs SNZ12 and A1530 first in
LIB5.GROUP4, then in SYS1.LINKLIB.
JCLLIB
• JCLLIB Statement
– JCLLIB is used to identify a private library or a system library from
which INCLUDE groups and JCL procedures are to be retrieved.
– The order in which the library names appear on the JCLLIB statement is
the order in which they are searched for any JCL procedures (PROCs)
and INCLUDE groups referenced by this job.
– Syntax
//[name ]JCLLIB ORDER=(library [,library ]...)[comments ]
– The private libraries that you specify on the JCLLIB statement must
comply with following rules:
The private library must be cataloged.
The private library must be accessible to the job.
– JCLLIB statement should be coded after JOB statement and before first
exec statement.
– //JCLLIB DD DSN=MMA2.PROCLIB,DISP=SHR
Special DD Names
• SYSOUT Statement:
– Specifies one character output class associated with SYSOUT
dataset
– Syntax SYSOUT=class
– If SYSOUT=* then output class specified in MSGCLASS
parameter of JOB statement is used
– Routes the system output to the class associated with output
device indicated
– class can be any alphanumeric character from A – Z, 0 – 9 or *
Special DD Names(Contd)
• SYSIN DD Statement
– The SYSIN DD statement is used to identify in-stream data sets.
– The data sets are marked by a DD * or a DD DATA parameter.
– Actually, these DD statements can have any DD name and SYSIN can
be one of these DD names.
– Syntax:
//SYSIN DD *
or
//SYSIN DD DATA ,DLM=xx
– Subparameter Definition:
In the above syntax, the following subparameters are used:
Special DD Names(Contd)
• * - indicates data than terminates with the /* Statement.
• DATA - indicates the data may contain special characters.
• DLM - indicates the two characters in the data that will terminate
the data set
– Examples:
//STEPA EXEC PGM=PROGRAM1
//SYSIN DD DATA,DLM=MY
data record 1
data record 2
...
data record n
MY end of data
Special DD Names(Contd)
• SYSPRINT Statement :
– SYSPRINT is job control statement used for defining a
sequential dataset for messages.The dataset can be written into
the system output device,a tape volume or a DASD volume.
– The block size for the SYSPRINT data set must be a multiple of
121.
Special DD Names(Contd)
• SYSUDUMP DD Statement :
– Produces a dump of user areas. The dump is formatted, so that
it can be printed directly.
– Example
//STEP2 EXEC PGM=A
//SYSUDUMP DD SYSOUT=A
// UNIT=3400-6,VOLUME=SER=147958
• Catalogued Procedures
– A procedure that you catalog in a library is called a cataloged
procedure.
– A cataloged procedure may consist of these JCL statements:
CNTL, command, DD, ENDCNTL, EXEC,
IF/THEN/ELSE/ENDIF, INCLUDE, OUTPUT JCL, and SET.
Optionally, a cataloged procedure can begin with a PROC
statement and end with a PEND statement. If coded, PROC
must be the first statement in the procedure.
Catalogued Procedures(Contd)
– Cataloging a Procedure
• The library containing cataloged procedures is a partitioned
data set (PDS) or a partitioned data set extended (PDSE).
The system procedure library is SYS1.PROCLIB. The
installation can have many more procedure libraries with
different names. You can also have procedures in a private
library. The name of a cataloged procedure is its member
name or alias in the library.
• When a cataloged procedure is called, the calling step
receives a copy of the procedure; therefore, a cataloged
procedure can be used simultaneously by more than one job.
Modifying Procedures
• JCL Overrides
– It is done whenever there is a need to override one or more
parameters in procedures. For example there is a JCL coded in
a procedure, which accesses a specific data set for a specific file
name. Instead of having to rewrite the procedure for the new
data set name we can easily override this parameter in the DD
statement without actually changing the contents of the original
procedure. The overrides for a procedure are activated only for
the duration of the job in which they exist. The original
parameters stay intact.
– Syntax
//MYPROC EXEC PROCNAME
//PROCSTEP.DDNAME DD MOD_PARAMETER1,
// MOD_PARAMETER2
Modifying Procedures(Contd)
– MYPROC is the stepname in the job that the procedure will be
executed from, PROCNAME is the name of the procedure
whose parameters will be overridden. PROCSTEP is the
stepname in the procedure whose parameters will be
overridden. DDNAME is the ddname of the DD statements
containing those parameters. The DD operation field may be
followed by one or more modified parameters
Modifying Procedures(Contd)
• Sample JCL for overriding parameters in a procedure :
In the input stream:
//JOB1 JOB ,'H.H. MORRILL'
//ADD1 OUTPUT COPIES=2
//STEPA EXEC PROC=P
//PS1.OUTA OUTPUT CONTROL=DOUBLE,COPIES=5
//PS1.DSB DD OUTPUT=*.ADD1
//PS1.DSE DD *
. (data) .
/*
Modifying Procedures(Contd)
//PS2.OUTB OUTPUT DEFAULT=YES,DEST=STL
In SYS1.PROCLIB member P:
//PS1 EXEC PGM=R15
//OUTA OUTPUT CONTROL=PROGRAM
//DSA DD SYSOUT=C,OUTPUT=*.OUTA
//DSB DD SYSOUT=D,OUTPUT=*.OUTA
//PS2 EXEC PGM=T48
//DSC DD SYSOUT=A
Exercise
1.Which of the following can be included in a procedure?
i)JOB statement ii)EXEC statement iii)DD * statement iv)//(delimiter)
• Example
– An Income Tax report is a generation data group with a new
generation added each year, chronologically and functionally
related to previous years. When a new generation is added, the
four previous reports must be retained for legal purposes, but
the fifth may be discarded.
– Generation data groups are referred to by a name and a relative
generation number.
Define a GDG
• For eg; DSN=A1000.TAX.STATE(0) refers to the current Tax report
• DSN=A1000.TAX.STATE(-1) refers to the previous Tax
report
• DSN=A1000.TAX.STATE(+1) refers to the new Tax report
that is to be created
• Creation of a GDG:
– The DEFINE GENERATIONDATAGROUP command creates a
catalog entry for a generation data group (GDG).
– A GDG can contain both SMS- and non-SMS-managed
generation data sets.
– A generation data set (GDS) cannot be a VSAM data set.
Define a GDG(Contd)
• Example 1: Creation of a GDG & GDS using a model data set.
//DEFGDG1 JOB ...
//STEP1 EXEC PGM=IDCAMS
//GDGMOD DD DSNAME=GDG01,DISP=(,KEEP),
// SPACE=(TRK,(0)),UNIT=DISK,VOL=SER=VSER03,
// DCB=(RECFM=FB,BLKSIZE=2000,LRECL=100)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GENERATIONDATAGROUP -
(NAME(GDG01) -
EMPTY -
NOSCRATCH -
LIMIT(255) )
/*
Define a GDG(Contd)
//STEP1 EXEC PGM=IEFBR14
//*
//* VSER03 must be the volume of GDGs catalog volume
//*
//GDGDD1 DD DSNAME=GDG01(+1),DISP=(NEW,CATLG),
// SPACE=(TRK,(10,5)),VOL=SER=VSER03,
// UNIT=DISK
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/*
//
Note : GDGMOD DD, which describes the GDG. When the scheduler
processes the DD statement, no space is allocated to GDG01.
JES3 handles resource management and workflow management before and after
execution or processing. The main functions of JES3:
• 1.Gather Jobs and data from local and remote input devices.
• 2.Present Jobs to the system scheduler for execution.
• 3.Monitor the execution.
• 4.print the output produced by the jobs on local & remote devices.
• 5.Remove Jobs from the system when complete
JES3 Control Statements(Contd)
• Some JES3 statements:
• //*Main
• //*Format
The //*MAIN statement is used to define the JES3 processor
requirements for your job.The //*MAIN statement consists of the
characters //*MAIN in columns 1 through 7, a blank in column 8, and
the necessary parameters anywhere in columns 9 through 72. You
should insert the //*MAIN statement for your job after the JCL JOB
statement and before the first EXEC statement in the job. //*MAIN
parameter{,parameter} ...
MODULE 11
DFSORT
• DFSORT is a program used to sort records in ascending or
descending
sequence, or to merge from 2 to 16 different files into one file.
• The input and output files processed by DFSORT can be sequential
or VSAM files containing fixed-length or variable-length format
records.
• DFSORT can be used in two ways
– Stand-alone sort/merge
Here, the DFSORT is invoked directly in an EXEC statement
– Internal sort/merge
Here, the DFSORT is invoked from a program written in a
high- level language.
DFSORT (Contd)
• Sorting Data Sets
– Sorting is arranging records in either ascending or descending order
within a file.
– The job control language (JCL) you need to do a sort depends on
whether you run DFSORT with the JCL EXEC statement or call
DFSORT from a program.
– The JCL statements you need for most jobs are described below.
• //jobname JOB
Signals the beginning of a job.
• //stepname EXEC
Signals the beginning of a job step and tells the operating
system what program to run.
//stepname EXEC PGM=SORT
DFSORT (Contd)
• //STEPLIB DD
Defines the library containing the DFSORT program
• //SYSOUT DD
Defines the output data set for messages.
• //SORTIN DD
Defines the input data set.
• //SORTWKdd DD
Defines a work storage data set for a sort.
• //SORTOUT DD
Defines the output data set.
• //SYSIN DD
Precedes the DFSORT program control statements.
DFSORT (Contd)
• Example
//EXAMP JOB A492,PROGRAMMER
//SORT EXEC PGM=SORT
//STEPLIB DD DSN=A492.SM,DISP=SHR
//SYSOUT DD SYSOUT=A
//SORTIN DD DSN=A123456.SORT.SAMPIN,DISP=SHR
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
//SORTOUT DD
DSN=A123456.SORT.SAMPOUT,DISP=OLD
//SYSIN DD *
SORT FIELDS=(110,10,A,145,17,A, 1,75,A),FORMAT=CH
/*
DFSORT (Contd)
• Merging Data Sets
– The MERGE control statement combines two or more identically
sequenced files (that is, files that have already been sorted
according to an identical set of ascending/descending keys) on
one or more keys and makes records available in merged order
to an output file.
– The JCL needed for a merge is the same as that for a sort, with
the following exceptions:
• Do not use the SORTWKdd DD statement
• Instead of the SORTIN DD statement, use SORTINnn DD
statements to define the input data sets.
• The SORTINnn DD statements name the input data sets,
and tell how many data sets will be merged.
• The value nn is a number from 00 to 99, indicating the
number of data sets to be merged.
DFSORT (Contd)
• Example
//EXAMP JOB A492,PROGRAMMER
//SORT EXEC PGM=SORT
//STEPLIB DD DSN=A492.SM,DISP=SHR
//SYSOUT DD SYSOUT=A
//SORTIN01 DD DSN=A123456.MASTER,DISP=OLD
//SORTIN02 DD DSN=A123456.NEW,DISP=OLD
//SORTOUT DD DSN=A123456.SORT.SAMPOUT,DISP=OLD
//SYSIN DD *
MERGE FIELDS=(110,5,A,1,75,A),FORMAT=CH
/*
DFSORT (Contd)
• Copying Data Sets
– DFSORT can also copy data sets without any sorting or merging
taking place.
– COPY can be used with all of the other DFSORT control
statements except SUM.
– The JCL for a copy application is the same as for a sort, except
SORTWKdd DD statement should not be used.
– The sample JCL shown as an example below will copy a data
set using the OPTION COPY statement
DFSORT (Contd)
• Example
//EXAMP JOB A492,PROGRAMMER
//SORT EXEC PGM=SORT
//STEPLIB DD DSN=A492.SM,DISP=SHR
//SYSOUT DD SYSOUT=A
//SORTIN DD DSN=A123456.SORT.SAMPIN,DISP=SHR
//SORTOUT DD DSN=A123456.SAMP.SORTOUT,DISP=OLD
//SYSIN DD *
OPTION COPY
/*
SORT FIELDS=COPY or MERGE FIELDS=COPY can be used
instead of OPTION COPY to produce the same results.
DFSORT (Contd)
• Parameters used in SORT
– The parameters used in SORT are INREC,OUTREC,INCLUDE,
OMIT, STOPAFT, OUTFIL,SUM
• INREC
– Reformats records before they are sorted, copied, or merged
• OUTREC
– Reformats records after they are sorted, copied, or merged
• INCLUDE
– INCLUDE control statement is used to collect the wanted records
• OMIT
– OMIT control statement is used to exclude the unwanted records
• STOPAFT
– STOPAFT is used to specify the maximum number of records that
should be accepted for sorting or copying.
DFSORT (Contd)
• SKIPREC
– SKIPREC is used to skip a specified number of records at the
beginning of the input file being sorted or copied.
• OUTFIL
– OUTFIL is used to create a multiple output dataset and reports
from a single pass over the input data set.
• SUM
– SUM is used to add the contents of fields whenever two records
with equal control fields are found. DFSORT places the result in
one record and deletes the other, reducing the number of
records to be sorted or merged.
– Delete records with duplicate control fields by specifying
FIELDS=NONE in a SUM statement
Tape Management System
• TMS Expiration and Retention Dates
• TMS selects volumes for deletion based upon the expiration date
supplied via parameter EXPDT or the retention period supplied via
JCL parameter RETPD. The value supplied via RETPD is converted
to a date. If no EXPDT or RETPD value is supplied, then the TMS
will take the default
retention period which is installation specific.
• Certain values supplied for EXPDT are TMS codes, rather than true
dates. The only currently valid TMS codes are explained below:
• 98000 - Used for external tapes unknown to TMS; used only when
reading a tape created by an outside agency or when writing to a
non-NWRDC tape volume
Tape Management
System(Contd)
• 98nnn - Retain for nnn days before scratching
• 99000 - CATLG controlled; i.e., when the dataset is uncataloged,
the tape will subsequently be scratched
• 99nnn - Retain for nnn cycles before scratching; this should only be
used with datasets with the same name, not with generation data
sets
• 99365 - Retain permanently
• Other values on the JCL EXPDT or RETPD parameters:
• LABEL=RETPD=0 - A temporary data set. If it is for the first file the
volume remains in scratch status after use.
• LABEL=EXPDT=yyyy/ddd - Standard MVS expiration date
• LABEL=RETPD=dddd - Standard system retention period
DFSMS
• Data Facility Storage Management Subsystem, commonly called
system managed storage or SMS Controls disk data set allocation
and management in an MVS environment. The complementary
functions of MVS/DFP and other individual products of the Data
Facility family, which, together with RACF provide a system-
managed, administrator-controlled storage environment.
• Functions :
– Eliminates the need to specify a physical volume when allocating
a data set
– Support for the new self reorganizing type of partitioned
datasets, PDSEs
– SMS data sets are automatically cataloged at creation, which
eliminates problems accompanying uncataloged data sets.