Jcl
Introduction to JCL Jcl coding sheet JOB Statement Exec statement DD Statement Concatenating Datasets Referback in JCL Special DD statements Utility Programs Utility program IEBGENER Utility programs IEBCOPY and IEBCOMPR DFSort DFSort reformat dataset DFSort INCLUDE OMIT COND Procedures generation data group (GDG) JCL quick study JCL Interview questionsWhat is a utility program
A program that is used by all users for the same purpose. For example, the compiler program (IGYCRCTL) used for compiling Cobol source codes. Utility programs provide many useful functions like
- Creating Datasets
- Copying datasets
- Sequencing datasets
- Deleting datasets
IBM supplied utility programs that are run in batch are the IBM utilities which are used only on normal datasets and VSAM IDCAMS utility which are used on normal and VSAM datasets.
IDCAMS
An example of JCL executing the IDCAMS
//Stepname EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
This prints the IDCAMS messages
//DDname DD DSN=…….
You can code more than one DD statement depending on the
operation
//SYSIN DD *
Some of the functions of IDCAMS
Command | Operation |
DEFINE | To allocate a dataset |
REPRO | To copy from one dataset to another |
DELETE | To delete a dataset |
To Print a dataset | |
RENAME | To rename a dataset |
LISTCAT | To list the system catalog information on datasets |
//Stepname EXEC PGM=the utility program-name
//SYSPRINT DD SYSOUT=*
This prints the utility program’s messages
//SYSUT1 DD …………..
Based on the operation, specifies the input dataset
//SYSUT2 DD …………..
Specifies the output dataset based on the operation
//SYSIN DD *
COPY INDD=SYSUT1,
OUTDD=SYSUT2
/*
In the previous example the control statements are after //SYSIN DD * line. The Control statements vary based on the utility program and the operation (to allocate or copy or delete dataset)
Utility Name | Function |
IEBGENER | Copies sequential datasets. Use IDCAMS REPRO statement instead. Note that members of PDS are sequential datasets too. |
IEBCOPY | Copies PDSs (use IDCAMS REPRO) and Compresses a PDS |
IEBCOMPR | Compares datasets. Instead use the SUPERC utility of ISPF which can be run on-line or in batch. |
IEHLIST | Lists DASD information. USE IDCAMS LISTCAT statement instead. |
IEHPROGM | Renames, deletes, catalog and uncatalog datasets, creates special datasets called Generation data groups (GDG). Use IDCAMS ALTER, DEFINE, DELETE statements instead. |
IEBUPDTE | Maintains PROCS and Source libraries. |
IEFBR14 | Allocates datasets. USE IDCAMS DEFINE statement instead. |
IEFBR14 program
IEFBR14 program is commonly called as NULL program and it is used to allocate empty datasets (PS and PDS). It is also used as a measure to check the existence of a dataset using DISP parameters. Lets look at an example where IEFBR14 is used to create a new and empty dataset with fixed record length of 80 bytes.
//PROGPUB1 JOB NOTIFY=PROGPUB
//STEP010 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DDNEW DD DSN=PROGPUB.NEW.DATASET
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1)),
// DCB=(LRECL=80,
// RECFM=FB,
// BLKSIZE=8000)
To create a new fixed PDS dataset modify the space parameter to use an additional value of directory blocks like shows in the example
//PROGPUB1 JOB NOTIFY=PROGPUB
//STEP010 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DDNEW DD DSN=PROGPUB.NEW.DATASET
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1, number of directory blocks))
// DCB=(LRECL=80,
// RECFM=FB,
// BLKSIZE=8000)
To create a new dataset with variable length records, the longest record being 80 data-bytes the DCB parameters should be coded as shown in the example. The logical record length (LRECL) should always be calculated with the maximum number of bytes of a record that is stored plus 4 bytes to store the length of the record. Record format should always be VB which is variable bytes.
//PROGPUB1 JOB NOTIFY=PROGPUB
//STEP010 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DDNEW DD DSN=PROGPUB.NEW.DATASET,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1)),
// DCB=(LRECL=84,
// RECFM=VB,
// BLKSIZE=8404)