Professional Documents
Culture Documents
1
Course Objectives
2
Sessions Outline
Session 1:
Overview of IBM Utilities
Main Types of Dataset Utilities
IDCAMS
Session 2:
IEBGENER, IEFBR14 , IEBCOPY
Session 3:
SORT, IEHPROGM, IEHLIST, IEBCOMPR, IKJEFT01,
ADRDSSU
3
OS/390 & z/OS - Utilities
Session 1
4
Session 1 - Coverage
Introduction – Utilities
Types of Utilities
Dataset Utilities
System Utilities
6
What is a UTILITY?
Each utility program falls into one of the two classes, based on the function
performed and the type of control of the utility. The three classes are:
Dataset utilities
program.
8
Dataset Utility Programs
IEBGENER
IEBCOPY
SORT
9
System Utilities
10
System Utility Programs
IEHPROGM
IEHLIST
11
Access Method Services
12
IDCAMS
13
IDCAMS
Purpose:
To work on the VSAM datasets
To copy a VSAM dataset to another flat file
To copy a VSAM to another VSAM (repro)
14
IDCAMS: Example 1
Example:
INDD is the input – and is a VSAM dataset
OUTDD is the output – and is a flat file created with Variable block size
(format = VB)
Example:
INDD is the input – an existing VSAM dataset
OUTDD is the output – a blank VSAM dataset
16
Session 1 - Summary
Types of Utilities
VSAM datasets
17
Functions of Utilities
Session 2
18
Session 2 - Coverage
19
IEFBR14
20
IEFBR14
Purpose:
21
IEFBR14: Create and Catalog a Dataset
Example 1:
//JOBCARD…
//STEP01 EXEC PGM=IEFBR14
//FILE1 DD DSN=TCS.EMP.MASTER,
// DISP=(NEW,CATLG,DELETE),
// UNIT=DISK,VOL=SER=TRG001,
// SPACE=(CYL,(10,10),RLSE),
// DCB=(RECFM=FB,LRECL=500)
22
IEFBR14: Uncatalog and Delete a Dataset
Example 2:
//JOBCARD…
//STEP01 EXEC PGM=IEFBR14
//FILE1 DD DSN=TCS.EMP.MASTER,
// DISP=(OLD,UNCATLG)
//*
//STEP02 EXEC PGM=IEFBR14
//FILE2 DD DSN=TCS.EMP.MASTER
// DISP=(OLD,DELETE),UNIT=DISK
//
23
IEBCOPY
24
IEBCOPY
Purpose:
Merge datasets
//JOBCARD…
//STEP01 EXEC PGM=IEBCOPY
//SYSPRINT DD Defines a sequential dataset for messages
//SYSUT1 DD or anyname1 Defines an INPUT partitioned dataset
//SYSUT2 DD or anyname2 Defines an OUTPUT partitioned dataset
//SYSUT3 DD Defines a spill dataset on a direct access device. It is
used when there is no space in virtual storage for some
or all of the current directory entries of the input PDS.
//SYSUT4 DD Defines a spill dataset on a direct access device. It is
used when there is no space in virtual storage for some
or all of the current directory entries of the output PDS.
//SYSIN DD Defines the CONTROL dataset
26
IEBCOPY: Example 1
To copy members from three partitioned datasets DATASET1, DATASET2, DATASET3 to
an existing partitioned dataset DATASET4.
//JOBCARD…
//STEP01 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//INOUT1 DD DSN=DATASET1,DISP=OLD
//INOUT2 DD DSN=DATASET2,DISP=OLD
//INOUT3 DD DSN=DATASET3,DISP=OLD
//INOUT4 DD DSN=DATASET4,DISP=OLD
//SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSIN DD *
COPYOPER COPY OUTDD=INOUT4,
INDD=INOUT1,
INDD=INOUT2,
INDD=INOUT3
/*
27
IEBCOPY: Example 2
//SYSIN DD *
COPYOPER COPY OUTDD=INOUT2
INDD=((INOUT6,R))
/*
28
IEBCOPY: Example 3
To copy members C,D,E,A and G from INOUT6 and INOUT2 to INOUT4.
(INOUT6, INOUT2 and INOUT4 are partitioned datasets)
//SYSIN DD *
COPYOPER COPY OUTDD=INOUT4
INDD=INOUT6
INDD=INOUT2
SELECT MEMBER=(C,D,E,A,G)
29
IEBCOPY: Example 4
In example 3, if members E and G can replace identically named member of
INOUT4, the control statements are as follows:
//SYSIN DD *
COPYOPER COPY OUTDD=INOUT4
INDD=INOUT6,INOUT2
SELECT MEMBER=(C,D,(E,,R),A,(G,,R))
30
IEBCOPY: Example 5
In example 4 the members C and D are renamed as J and K respectively
and G replaces identically named member of output PDS
E is renamed T and replaces identically named member of output PDS
//SYSIN DD *
COPYOPER COPY OUTDD=INOUT4
INDD=INOUT6,INOUT2
SELECT MEMBER=((C,J),(D,K),(E,T,R),A,(G,,R))
31
IEBCOPY: Example 6
Suppose in a copy operation from INOUT1 to INOUT2, members A, B, C
and D have to be excluded
//SYSIN DD *
COPYOPER COPY
OUTDD=INOUT2,INDD=INOUT1
EXCLUDE MEMBER=(A,B,C,D)
/*
32
IEBCOPY: Example 7
To Compress a partitioned dataset, assign the same dataset name to INDD
and OUTDD
//SYSIN DD *
COPY OUTDD=DATASET1,INDD=DATASET1
/*
33
IEBCOPY: Example 8
Multiple COPY operations to copy members A and B from DATASET1 and all members of
DATASET2 except C and G to DATASET3
All members copied from DATASET2 are permitted to replace identically named members
of DATASET3
//SYSIN DD *
COPYOPER COPY OUTDD=DATASET3,
INDD=DATASET1
SELECT MEMBER=(A,B)
COPY O=DATASET3,
I=(DATASET2,R)
EXCLUDE MEMBER=(C,G)
/*
34
IEBGENER
35
IEBGENER
Purpose:
To copy sequential datasets
Create a backup of a sequential dataset or a member of a partitioned
dataset
Produce a partitioned dataset or a member of a partitioned dataset, from
a sequential input dataset
Expand an existing partitioned dataset by creating partitioned members
and merging them into the existing dataset
Produce an edited sequential of partitioned dataset
Convert data formats, rearrange input fields and change the logical record
length of a dataset
36
IEBGENER: Job Control Statements
//JOBCARD…
//STEP01 EXEC PGM=IEBGENER
//SYSPRINT DD Defines a sequential dataset for messages
(System output device / Tape volume / DASD
volume)
//SYSUT1 DD Defines the INPUT dataset (Sequential dataset /
Member of a PDS)
//SYSUT2 DD Defines the OUTPUT dataset (Sequential dataset /
PDS / Member of a PDS)
//SYSIN DD Defines the CONTROL dataset (Very often
DUMMY)
37
IEBGENER: Example 1
To copy a Tape file TCS.EMP.MASTER of VOL SER 007311, to a DASD
file TCS.EMP.MST.DISK. The Input Employee master record is 500 bytes in
length
//JOBCARD…
//STEP1 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=TCS.EMP.MASTER,UNIT=TAPE,DISP=OLD,
// VOL=SER=007311,LABEL=(,SL)
//SYSUT2 DD DSN=TCS.EMPMST.DISK,UNIT=DISK,
// VOL=SER=TCS3010,DISP=(NEW,CATLG),
// SPACE=(TRK,(10,10)),DCB=(RECFM=FB,LRECL=500)
//SYSPRINT DD SYSOUT=A
//SYSIN DD DUMMY
38
Utility Control Statements
GENERATE
RECORD
MEMBER
39
GENERATE, RECORD & MEMBER Statements
41
Record Statement: FIELD Parameters
//SYSIN DD *
GENERATE MAXFLDS=3,MAXLITS=11
RECORD FIELD=(10,'**********',,1),
FIELD=(5,1,,11,),
FIELD=(1,'=',,16)
/*
44
Record Statement: IDENT Parameters
Name: Exact literal that identifies the last input record of each record
45
IEBGENER: Example 4
The sequential input has FIRSTMEM as the first 8 characters of the last
record of the first member, and SECNDMEM for the second member
46
IEBGENER: Example 4
//JOBCARD…
//STEP01 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSN=INSET,DISP=OLD
//SYSUT2 DD DSN=NEWSET,UNIT=DISK,DISP=(NEW CATLG),
// VOL=SER=TRG001,SPACE=(TRK,(5,5,5)),DCB=(RECFM=FB,LRECL=80)
//SYSIN DD *
GENERATE MAXNAME=3,MAXGPS=2
MEMBER NAME=MEMBER1
GROUP1 RECORD IDENT=(8,'FIRSTMEM',1)
MEMBER NAME=MEMBER2
GROUP2 RECORD IDENT (8,'SECNDMEM',1)
MEMBER NAME=MEMBER3 47
Session 2 - Summary
48
Functions of Utilities
Session 3
49
Session 3 - Coverage
IEHPROGM
IEHLIST
IEBCOMPR
IKJEFT01
ADRDSSU
50
Sort/Merge Utility
51
Sort/Merge Basics
Reformat records
52
Job Control Statements for SORT
//JOBCARD…
//STEPNAME EXEC PGM=SORT
//STEPLIB DD <Defines the library containing the DFSORT pgm>
//SYSOUT DD <Defines the message dataset>
//SORTIN DD <Defines the INPUT dataset>
//SORTWKnn DD <Defines a WORK storage dataset>
//SORTOUT DD <Defines the OUTPUT dataset>
//SYSIN DD <Contains DFSORT program control statements>
53
SORT Statement Basics
Write the fields in parentheses, separated by commas
The starting position of the key field
Length of the key field in bytes
A code for data format
Letter 'A' for Ascending order or 'D' for Descending order
Example:
1 2......................................................71
SORT FIELDS=(110,5,CH,A)
54
Data Format Codes
Data Format Code
EBCDIC Character CH
ASCII Character AC
Binary BI
Zoned Decimal ZD
Packed Decimal PD
55
SORT: Example 1
SORT FIELDS=(110,5,CH,A,115,5,CH,A,1,75,CH,A)
SORT FIELDS=(110,10,CH,A,1,75,CH,A)
When all the control fields are of the same data format, then
SORT FIELDS=(110,10,A,1,75,A),FORMAT=CH
56
SORT JCL: Example 2
57
SORT JCL: Example 2
//JOBCARD…
//STEP01 EXEC PGM=SORT
//STEPLIB DD DSN=IBM.UTIL.LOADLIB,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= BOOK.STORE.INPUT,DISP=OLD
//SORTWK01 DD UNIT=3380,SPACE=(TRK,(1,1))
//SORTOUT DD DSN=BOOK.STORE.OUT,
// DISP=(NEW,CATLG,DELETE),UNIT=DISK,
// VOL=SER=TRG001,SPACE=(CYL,(10,1),RLSE),
// DCB=(RECFM=FB,LRECL=173,BLKSIZE=1730)
//SYSIN DD *
SORT FIELDS=(110,10,CH,A,162,4,BI,D)
/*
58
MERGE Files
59
MERGE JCL: Example 1
60
MERGE JCL: Example 1
//JOBCARD…
//STEP01 EXEC PGM = SORT
//STEPLIB DD DSN=IBM.UTIL.LOADLIB,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=BOOK.STORE.INPUT1,DISP=OLD
//SORTIN02 DD DSN=BOOK.STORE.INPUT2,DISP=OLD
//SORTIN03 DD DSN=BOOK.STORE.INPUT3,DISP=OLD
//SORTOUT DD DSN=BOOK.STORE.OUT,DISP=(NEW,CATLG,DELETE),
//UNIT=DISK,VOL=SER=TRG001,SPACE=(CYL,(10,1),RLSE),DCB=(RECF
M=FB,LRECL=173,BLKSIZE=1730)
//SYSIN DD *
MERGE FIELDS=(110,10,CH,A,162,4,BI,D)
/* 61
Other Sort/Merge Control Statements
62
Tailoring the input file
Another field or
63
How to write INCLUDE/OMIT statements
Syntax:
INCLUDE COND=(field,comparison,{field }, [ {AND}, ]…)
{constant} {OR }
OMIT COND=(field,comparison,{field }, [ {AND}, ]…)
{constant} {OR }
Write in parentheses, and separated by commas:
the position, length, and data format of the field to be compared
comparison operator
the position, length, and data format of the field compared against OR
a constant
64
List of Comparison operators
Operators
EQ Equal To
NE Not Equal To
GT Greater Than
GE Greater Than Or Equal To
LT Less Than
LE Less Than Or Equal To
65
INCLUDE statement: Example
Suppose in a Book store file we want only the books (in ascending order of
book title) for which the number of copies sold YTD that has exceeded 250
INCLUDE COND=(166,4,BI,GT,250)
SORT FIELDS=(1,75,CH,A)
66
OMIT statement: Example
Suppose only those books for which NUMBER SOLD YTD exceeds 125
and the LAST NAME of the author is MARTIN are to appear in the
OMIT COND=(166,4,BI,LE,125,OR,76,15,CH,NE,C'MARTIN')
SORT FIELDS=(170,4,BI,D)
67
Rules for padding/truncation
Note:
68
Reformatting
Reformatting records with OUTREC: After records are sorted they can be
reformatted by using OUTREC control statement.
69
How to write the OUTREC statement?
Syntax:
INREC FIELDS=([c:][separation-fld,]position,length[,align,]…)
OUTREC FIELDS=([c:][separation-fld,]position,length[,align,]…)
Specify the input location and length of the fields to appear, in the desired order
(data format is not specified)
Write in parentheses and separated by commas:
c: Specifies the column (byte) in which a data field or separation field should be
placed, relative to the start of the record
align tells the sort/merge utility to align the field on a halfword (H), fullword (F),
or doubleword (D) boundary
70
Reformatting the Output Record: Example 1
71
OUTREC: Example 2
72
OUTREC: Example 3
OUTREC FIELDS=(20X,1,75,4Z,162,4)
73
Reformatting records with INREC
The INREC control statement allows to reformat the input records before
they are processed
Reformatting is performed before SORT/MERGE
Note:
If reformatting using INREC changes the location of key fields, the new
location has to be specified in the SORT statement
74
INREC: Example
If only the BOOK TITLE and NUMBER SOLD YTD are to appear in
descending order of NUMBER SOLD YTD the following control statement
has to be given:
//SYSIN DD *
INREC FIELDS=(1,75,166,4)
SORT FIELDS=(76,4,BI,D)
/*
75
IEHPROGM
76
IEHPROGM
Catalog a Dataset
Un catalog a Dataset
Rename Datasets
77
IEHPROGM
//JOBCARD…
//STEPNAME EXEC PGM=IEHPROGM
//SYSPRINT DD SYSOUT=print-device-class
//SYSUT1 DD UNIT=unitname,
// VOL=SER=vol-no
//SYSUT2 DD UNIT=unitname,
// VOL=SER=vol-no
//SYSIN DD *
<- parameters for above functions ->
/*
//
78
IEHPROGM
79
IEHPROGM
A dataset can be uncataloged using the UNCATLG statement.
Syntax:
//SYSIN DD *
UNCATLG DSN=data-set-name
/*
//
80
IEHPROGM
81
IEHLIST
82
IEHLIST
83
IEHLIST
Example 1: To list the VTOC of a specified DASD Volume given Volume
name and disk type.
//JOBCARD…
//STEP010 EXEC PGM=IEHLIST
//*
//SYSPRINT DD SYSOUT=*
//*
//DD4 DD UNIT=SYSDA,VOL=SER=MVSDLB,DISP=OLD
//*
//SYSIN DD *
LISTVTOC VOL=3350=MVSDLB
/*
//
84
IEHLIST
Example 2: To list the members and statistics for a PDS .
//SYSIN DD *
LISTPDS DSNAME=(SYS1.LINKLIB),VOL=3350=MVSRES
/*
Example 3: To list the Catalog (ie datasets that are in the catalog) for a
specific DASD volume
//SYSIN DD *
LISTCTLG VOL=3350=PUB000
/*
85
IEBCOMPR
86
IEBCOMPR
If the two datasets are identical then zero will be returned upon successful
If the datasets are not identical then a condition code of 8 will be returned
The datasets that are compared must have same record length and format,
87
IEBCOMPR
Syntax:
//JOBCARD…
//STEPNAME EXEC PGM=IEBCOMPR
//SYSPRINT DD SYSOUT=print-device-class
//SYSUT1 DD DSN=data-set-1-features
//SYSUT2 DD DSN=data-set-2- features
//SYSIN DD *
COMPARE TYPORG=data-set-type
/*
//
88
IKJEFT01
89
IKJFET01
Purpose:
To issue TSO commands through the JCLs
To copy files from and to oMVS, and MVS
90
IKJEFT01: Example 1
INDD means the input file in the oMVS that needs to be copied onto the flat file -
JES DD
91
IKJEFT01: Example 2
92
ADRDSSU
93
ADRDSSU
Purpose:
To move huge data from one volume to another
94
ADRDSSU
Example:
INDD is the input, or the volume from which the datasets need to be moved
OUTDD is the output volume
The include option can be used to mention different qualifiers (say HLQ.** or HLQ.NEXT.** or
** - for all)
//MOVE01 EXEC PGM=ADRDSSU,REGION=0M
//SYSPRINT DD SYSOUT=*
//INDD DD VOL=SER=Y2KZ02,UNIT=3390,DISP=SHR
//OUTDD DD VOL=SER=DEVZ20,UNIT=3390,DISP=SHR
//SYSIN DD *
COPY DS(INCLUDE(**)) -
LIDD(INDD) -
OUTDD(OUTDD) -
ALLDATA(*) -
CATALOG DELETE
//
95
Session 3 - Summary
96
Course Summary
Purpose of Utilities
Main Types of Utilities
Functions of each type of Utility
IEBGENER, IEFBR14, IEBCOPY
Sort/Merge Operations
INCLUDE/OMIT and INREC/OUTREC Control Statements
97
References
Murach’s OS/390 and z/OS JCL by Raul Menendez and Dough Lowe
98
THANK YOU
99