Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Course Objectives
Appreciate the use of Utilities Know the Types of Utilities Have an in-depth knowledge of common IBM Utilities Know the purpose and structure of each Utility Know the usage of the various parameters of different Utilities Be able to write Utilities and execute them
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
Session 1 - Coverage
Introduction Utilities Types of Utilities Dataset Utilities System Utilities Access Method Services
5
Introduction - Utilities
Frequently performed function:
Copy sequential files / partitioned datasets / VSAM Catalog / Uncatalog datasets Rename datasets Compress partitioned datasets Include / Exclude members to partitioned datasets when a copy transaction is implemented Compare sequential and partitioned datasets Generate generation data groups Create/delete datasets allocate/deallocate space on datasets or code other functions on the DD statement, without having to execute a program
6
What is a UTILITY?
A UTILITY program performs a basic function, i.e., it does a routine job which is required repeatedly in an installation. IBM provides a number of prewritten utility programs to assist users in organizing and maintaining data 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 System utilities and Access Method Services
7
Dataset Utilities
Dataset Utility Programs, Can be used to create, reorganize, change or compare data at the dataset or record level. Can be executed as jobs or be invoked as subroutines of a calling program.
System Utilities
System Utility Programs: System utility programs can be used to maintain and manipulate system and user datasets These programs must reside in an authorized library They can be executed as jobs or be invoked as subroutines of an authorized program
10
11
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) //STEP1 EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //INDD DD DISP=SHR,DSN=(existing VSAM dataset) //OUTDD DD DISP=SHR,DSN=(existing flat file) //SYSIN DD * REPRO INFILE(INDD) OUTFILE(OUTDD)
15
IDCAMS: Example 2
Example: INDD is the input an existing VSAM dataset OUTDD is the output a blank VSAM dataset //STEP1 EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //OUTDD DD DISP=SHR,DSN=SSG1M.RKR.UTIL.VSAM.AIF //INDD DD DISP=SHR,DSN=SSG1M.RKR.UTIL.VSAM.REPRO.IN //SYSIN DD * REPRO INFILE(INDD) OUTFILE(OUTDD)
16
Session 1 - Summary
Frequently performed functions Requirement for utilities Types of Utilities Dataset Utilities - Operate on the data at dataset or record level System Utilities Operate on the user datasets Access Method Services IDCAMS operate on both VSAM and Non VSAM datasets
17
Functions of Utilities
Session 2
18
Session 2 - Coverage
IEFBR14 - Null Program IEBCOPY Copy datasets IEBGENER Work on PDS members
19
IEFBR14
20
IEFBR14
Purpose: Carries out no processing of its own Used to Create and Catalog empty datasets Delete datasets that are no longer required
21
22
DD DSN=TCS.EMP.MASTER, DISP=(OLD,UNCATLG)
DISP=(OLD,DELETE),UNIT=DISK
IEBCOPY
24
IEBCOPY
Purpose: To perform functions on Partitioned Datasets To copy a Partitioned Dataset to a DASD Volume Compress Partitioned datasets Merge datasets Copy PDS to another PDS or PS (unloading) Restore a PDS from a tape backup to a DASD (loading) Select / Exclude members of a PDS in a Copy operation
25
//SYSUT3 DD
//SYSUT4 DD
//SYSIN DD
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
To copy all the members of INOUT6 (PDS) to INOUT2 (PDS) replacing identically named members. //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
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
41
Length - Length in bytes of the input field or literal to be processed. Default is 80 bytes. If a literal is to be processed, a length of 40 or less must be specified
Input-location or literal Specifies the starting byte of the field to be processed. Default is 1 Specifies a literal to be placed in the specified output location Conversion: specifies a two-byte code that indicates the type of conversion to be performed on this field. Default (NO conversion) Output-location: Specifies the starting location of this field in the output records. Default is 1.
42
IEBGENER: Example 2
//JOBCARD //EXEC PGM=IEBGENER //SYSIN DD * GENERATE MAXFLDS=1 RECORD FIELD=(35,1,,1) /* //SYSPRINT DD SYSOUT=* //SYSUT1 DD * Dataset to be copied /* //SYSUT2 DD DSN=name,UNIT=DASD, // DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(3,1),RLSE), // DCB=(LRECL=35,RECFM=FB)
43
IEBGENER: Example 3
//SYSIN DD * GENERATE MAXFLDS=3,MAXLITS=11 RECORD FIELD=(10,'**********',,1), FIELD=(5,1,,11,), FIELD=(1,'=',,16) /*
44
Identifies the last record of a collection of records in the input dataset Length: in bytes of the identifying names; cannot exceed 8 bytes Name: Exact literal that identifies the last input record of each record group (include in quotes) Input-location: Starting byte of the field that contains the identifying name in the input records
45
IEBGENER: Example 4
Create a partitioned dataset consisting of three members, MEMBER1, MEMBER2, MEMBER3 from sequential input 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
IEFBR14 - Null Program IEBCOPY Copy datasets IEBGENER Work on PDS members
48
Functions of Utilities
Session 3
49
Session 3 - Coverage
Sort / Merge Utility IEHPROGM IEHLIST IEBCOMPR IKJEFT01 ADRDSSU
50
Sort/Merge Utility
51
Sort/Merge Basics
Sort/Merge Utility used to Sort records in ascending or descending order within a file Merge two or more files into a single file Select a subset of records from an input file SUM values in records Reformat records
52
53
54
55
SORT: Example 1
Now let us consider sorting by multiple fields like COURSE DEPARTMENT, COURSE NUMBER and BOOK TITLE. Then, SORT FIELDS=(110,5,CH,A,115,5,CH,A,1,75,CH,A) This is EQUIVALENT to: 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
57
MERGE Files
Files to be merged should be sorted on the same set of keys on which they are being merged Do not use SORTWKnn DD statement Instead of SORTIN DD, use SORTINnn DD; one SORTINnn DD statement for each input file nn --> 01 to 16 In Utility Control Statements, MERGE replaces SORT
59
Merge 3 files that have been sorted in ASCENDING order of COURSE DEPARTMENT ASCENDING order of COURSE NUMBER DESCENDING order of NUMBER IN STOCK
60
MERGE FIELDS=(110,10,CH,A,162,4,BI,D)
62
63
field to be compared
65
66
67
Reformatting
Reformatting records with OUTREC: After records are sorted they can be reformatted by using OUTREC control statement. Fields can be deleted Order of the fields can be rearranged Zeroes or blanks can be inserted BEFORE, BETWEEN or AFTER fields If record length gets changed in the process of using OUTREC statement, the new record length has to be specified on the SORTOUT DD statement
69
71
OUTREC: Example 2
If it is required to add a 4-byte Binary field between BOOK TITLE and NUMBER IN STOCK and fill it up with ZEROES, the following control statement has to be given: OUTREC FIELDS=(1,75,4Z,162,4)
72
OUTREC: Example 3
Suppose a 20 character blank field is to be prefixed to the output records, the following control statement has to be given: OUTREC FIELDS=(20X,1,75,4Z,162,4) LRECL on the SORTOUT DD statement should be 103
73
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 Create an index of a GDG Delete the index of an existing GDG
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
A dataset can be cataloged using the CATLG statement Syntax: //SYSIN DD * VOL=device-name=vol.no /* // CATLG DSN=data-set-name
79
IEHPROGM
A dataset can be uncataloged using the UNCATLG statement. Syntax: //SYSIN DD * UNCATLG DSN=data-set-name /* // SYSUT2 is not coded
80
IEHPROGM
A dataset can be renamed using the RENAME command Syntax: //SYSIN DD * RENAME DSN=data-set-name, VOL=device-name=volume=number NEWNAME=new-name /* //
81
IEHLIST
82
IEHLIST
Used to list a PDS directory, VTOC or system catalog
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
Used to Compare two sequential datasets Compare two partitioned datasets If the two datasets are identical then zero will be returned upon successful completion of the job 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, however block size need not be the same
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 //COPY EXEC PGM=IKJEFT01 //JES DD DSN=HLQ.IN,DCB=(RECFM=V,LRECL=256),DISP=NEW //IN DD PATH='/usr/lpp/ssg/ssgrav/in', // PATHOPTS=ORDONLY //SYSTSPRT DD DUMMY //SYSTSIN DD * OCOPY INDD(ERRORF) OUTDD(JES) //*
91
IKJEFT01: Example 2
To get a list of datasets that start with a particular HLQ //LISTMEM EXEC PGM=IKJEFT01 //SYSTSPRT DD DSN=SSGRAV.MEMBERS,DISP=NEW //SYSTERM DD DUMMY //SYSTSIN DD * PROFILE PREFIX(HLQ) LISTCAT
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
Sort / Merge Utility IEHPROGM Catalog, Uncatalog, Rename, Create/Delete GDG index IEHLIST List VTOC, PDS and Catalog IEBCOMPR Compare datasets IKJEFT01 Issue TSO Commands ADRDSSU Move Volumes of data
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
Murachs OS/390 and z/OS JCL by Raul Menendez and Dough Lowe System 390 Job Control Language by Gary DeWard Brown
98
THANK YOU
99