You are on page 1of 91

JCL DAY 3

Overview
IBM Utilties

Overview
IBM Utilties

 IEFBR14 -> CREATE A DATASET

 IEBGENER -> CREATE BACKUP OF SEQUENTIAL


DATASET

 IEBCOPY -> COPY DATASET FROM A PDS TO PDS OR


MEMBER
 SORT -> SORT DATA IN ASCENDING/DESCENDING
ORDER
 IDCAMS -> CREATE GDG OR VSAM
IEBGENER

 Create a backup of a sequential dataset or a member of a

partitioned dataset

 Produce a partitioned dataset or a member of it from a

sequential dataset

 Expand an existing Partitioned dataset by creating

members and merging them into existing datasets


IEBGENER JCL

//JOB Card…..

//STEP EXEC PGM=IEBGENER

//SYSPRINT DD <Specify dataset for messages>

//SYSUT1 DD <Specify input dataset>

//SYSUT2 DD <Specify output dataset>

//SYSIN DD <Specify control dataset>


INPUT FILE (SYSUT1)
OUTPUT FILE GENERATED AFTER Running
IEBGENER Utility
SPOOL Message
Exercise: COPY A PDS
member to Physical
Sequential Dataset
Exercise : Copy a PDS
Member to Another PDS
member
Question and Answer

 IEBGENER can be used to COPY A Physical sequential


Dataset to another Physical Sequential Dataset ( T/F)
 IEBGENER can be used to COPY a PDS member to
another PDS Member ( T/F)
 IEBGENER can be used to COPY a PDS to another PDS
( T/F)
IEBCOMPR

oVERVIEW
IEBCOMPR Utility

 The IEBCOMPR utility provides // JOB CARD STATEMENT


the ability to verify that the
contents of two datasets are
identical.  //STEP1 EXEC PGM=IEBCOMPR
 The datasets to be compared //SYSPRINT DD SYSOUT= *
may be
 Physical sequential (PS) //SYSUT1 DD DSN=DATASET1,UNIT=SYSDA,
 Partitioned (PO) organization.  // VOL=SER=LEM001, DISP=SHR

 Four DD cards are required: 


//SYSUT2 DD DSN=DATASET2,UNIT=SYSDA,
 The datasets to be compared
are specified with the SYSUT1 // VOL=SER=D10040, DISP=SHR
and SYSUT2 DD cards.
 Output produced by the utility is //SYSIN DD *   
written to the SYSPRINT DD card
COMPARE TYPORG=PS
 Utility control statements are /*
read from the SYSIN DD card.
//
SPOOL Message
Exercise: Compare Two
PDS using IEBCOMPR
Utility
IEBCOPY

Overview
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.
IEBCOPY Utility
SPOOL Message
IEBCOPY : Copy only
Selected Member

Overview
SELECT MEMBERS
SORT Utility

Overview
SORT

 Arranges records in a file in ascending or descending

sequence

 Provides tailoring feature to select a subset of records from

file for sorting

 Can reformat output file records after sorting

 Merges two or more file into a single file


SORT JCL

//JOB CARD………. <Specify JOB Card details here>

//STEPNAME EXEC PGM=SORT

//STEPLIB DD <Specify library containing SORT program here>

//SYSOUT DD <Specify the SORT Message dataset here for SORT utility to
write messages as it executes>

//SORTIN DD <Specify the SORT INPUT dataset here>

//SORTWKnn DD <Specify the SORT temporary Work storage dataset


here>

//SORTOUT DD <Specify the SORT OUTPUT dataset here>

//SYSIN DD <Specify SORT control statements here either as


instream data or within a dataset to control the way
sorting has to be done>
SORT - SYSIN
Parameters

 Sort statements are coded through SYSIN which can be instream or cataloged
 Dataset specified in SYSIN can be either a PS or a PDS
 SORT FIELD statement to be preceded by at least one blank space
 Format is
 SORT FIELD=(<start-pos>,<length-in-bytes>,<field-format>,<sort-
sequence>)
 <start-pos>, specifies starting position of field on which sorting is to be
done
 <length-in-bytes>, specifies length of sort field in bytes
 <field-format>, specifies data format of the sort field. Field formats are
 CH for EBCDIC character sequence
 AC for ASCII character sequence
 BI for Binary sequence
 ZD for Zoned Decimal
 PD for Packed Decimal
 <sort-sequence> is either “A” or “D” indicating Ascending or Descending
Input File
Output File BEFORE Executing Utility
SORT UTILITY
SPOOL MESSAGE
OUTPUT FILE GNERATED AFTER RUNNING
SORT UTILITY
Remove Duplicate Rows
While Sorting Data using
SORT UTILITY
INPUT DATA WITH DUPLICATE ROWS
OUTPUT FILE BEFORE RUNNING
Utility
SORT Utility
Output file after running Utility
MERGE

Overview
Merge

 This process takes records from up to 16 sorted data sets and


combines them in a single sorted output data set.
 The merge control statement format is similar to that of the
sort. Input data sets must already be sorted in the same
sequence.

//STEP1 EXEC PGM=SORT


//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=MTPL.SEQ1,DISP=OLD
//SORTIN2 DD DSN=MTPL.SEQ2,DISP=OLD
//SORTOUT DD DSN=MTPL.SEQ3,DISP=OLD
//SYSIN DD *
MERGE FIELDS =(21,2,CH,A)
/*
INPUT FILE 1
INPUT FILE 2
MERGE
OUTPUT FILE AFTER MERGE
OPERATION
JCL DAY 4
Procedures in JCL

oVERVIEW
Procedures

 Abbreviated as PROC

 Consists of pre-tested JCL statements which is given a name

 Helps in minimizing duplication of code and hence errors

 Two types

 Instream Procedures

 Cataloged Procedures
Instream Procedures

 Coded within the input stream of the JOB

 Can be invoked more than once within the JOB

 Starts with a PROC statement and ends with a PEND


statement

 Formats for invoking the PROC are:

 EXEC <procname>
 EXEC PROC=<procname>
 <procname> must be 1 to 8 characters long
Symbolic
Parameters

 Allows same JCL procedure to be used with


different parameters

 Very often used in situations where same JCL is


used by different programmers with different
parameters to access different datasets

 Consists of 1 to 8 characters. The first character


must be &
Instream procedure
SPOOL MESSAGE
OUTPUT
Cataloged
Procedure

 Consists of a set of JCL statements that are grouped


together, given a name and cataloged as a member of a
Partitioned dataset

 Procedure name must be unique within the procedure


library

 PEND statement is not required


Cataloged
Procedure

 Library to search the cataloged statements is specified


through the JCLLIB operator

 One or more libraries can be specified in the JCLLIB

 In the visual, the procedure named SAMPLE is invoked. It


exists as a member in the Partitioned dataset
P390B97.PROCLIB that is specified in the JCLLIB
CATALOG PROCEDURE
PROCEDURE AND MEMBER (SAME
NAME)
PROCEDURE CALLING IN OTHER JCL
(JCLLIB)
SPOOL MESSAGE
OUTPUT
IDCAMS Utility

Overview
IDCAMS Utility

 Utiltiy is used for Creation

 VSAM Dataset
 NON VSAM
 GDG (Generation Data Group )
What is GDG

 A Generation Data Group (GDG) consists of like-


named data sets that are chronologically or
functionally related. A data set in a GDG is called a
generation.
GDG

There are five control statement parameters which are used in creating a GDG base catalog entry.
They are:

LIMIT Maximum number of generations allowed for this GDG entry


EMPTY When limit is exceeded, uncatalog all generations.
NOEMPTY When limit is exceeded, uncatalog oldest entry only
SCRATCH Delete any uncataloged generation.
NOSCRATCH Do not delete any uncataloged generation.

The model DSCB (//DSCB in the example above) ensures that the same DCB and EXPDT
information is used to create all generations. This ensures greater consistency among generations.

The model DSCB must be allocated with Zero space, and it cannot be cataloged.

The model DSCB must also lie on the same volume where the base catalog entry is cataloged.
DEFINE GDG
OUTPUT
Example: Use IEBGENER
utility to copy data from
PS to GDG VERSION

Overview
INPUT FILE
GDG VERSION
IEBGENER
OUTPUT FILE
GDG- DSNAME specification (Continued)

The generation number starts with G0001 for the first generation and is incremented
by the value coded in the relative data set name.
For Example:
RELATIVE NAME ABSOLUTE NAME

NAME.GDG(+0) NAME.GDG.G0003V00 current generation


NAME.GDG(-1) NAME.GDG.G0002V00 current generation -1
NAME.GDG(-2) NAME.GDG.G0001V00 current generation -2

IBM does not use the V00 or Version number. The version number is set to V00 with the
first generation. If a generation is damaged and needs to be replaced, an installation can code
the absolute name with a new version number, to replace the damaged generation, such as

//INDD DD DSN=NAME.GDG.G0052V00,DISP=OLD
//OUTDD DD DSN=NAME.GDG.G0052V01,DISP=(,CATLG)
Creating New
Generation

Example
CREATING NEW GENERATION
OUTPUT
SCRATCH AND EMPTY
Option

Example
Parameters of DEFINE GDG

There are five control statement parameters which are used in creating a GDG base
catalog entry. They are:

LIMIT Maximum number of generations allowed for this GDG entry


EMPTY When limit is exceeded, uncatalog all generations.
NOEMPTY When limit is exceeded, uncatalog oldest entry only
SCRATCH Delete any uncataloged generation.
NOSCRATCH Do not delete any uncataloged generation.
SCRATCH AND EMPTY
GDG CREATION
GENERATION OF NEW VERSION
REPRO COMMAND IN
IDCAMS Utility
INPUT DATASET
OUTPUT DATASET BEFORE REPRO
REPRO COMMAND
OUTPUT DATASET
DELETE GDG
GDG VERSION
DELETE GDG VERSION – FORCE
OPTION
SPOOL MESSAGE
DELETE GDG – WITH GDG OPTION
END

You might also like