You are on page 1of 74

Utilities

Department of Computer Science


Northern Illinois University
1999

Utilities
The mainframe utilities are general purpose
programs available for common tasks.
Usually are supplied by the hardware vendor.
Sometimes purchased from independent
software vendors.
e.g., Syncsort, faster and cheaper than IBMs sort
utility.

Utilities
Common tasks:

Sorting
Copying files
Printing files
Comparing 2 files (look for differences, IBMs stops
after 10 different lines)
Maintenance (e.g., one to compress (update) a PDS)
ZAP utility (change code (bits, bytes) in load mods;
add patch area to load mod)
3

IEBPTPCH
Can use it to:
Print qsam data sets.
Print selected members of a PDS or entire PDS.
Print selected records from QSAM or PDS
member.
Print PDS directory.

IEBPTPCH
Default output:
Alphanumeric.
Unprintable chars (e.g., X00) appear as blanks.
Each logical record on a new line
If longer than 80 then it wraps around.

Each line in groups of 8 chars separated by 2 blanks.


Each logical record delimited with *.
Each physical record delimited with ** (if file is
blocked).
5

IEBPTPCH
Defaults can be changed using control
statements:
E.g., if record length <= output device record length
(132), can specify a format other than the 8 chars at a
time format.
E.g., can specify data conversion of either the whole
record or selected fields in the record for converting
packed to zoned decimal; can specify to print in hex.

Required JCL...
6

//STEPn EXEC PGM=IEBPTPCH


job/steplib needed
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=input data set
//SYSUT2 DD SYSOUT=*
//SYSIN DD DSN=data set
statements; qsam or pds
//SYSIN DD *
control statements
/*
//SYSIN DD DUMMY
stments & going with

catalogued, so no
prtpunch messages
qsam or name of PDS
output device
containing control
mem

if omitting control
defaults

IEBPTPCH
Basically, all utilities have this general
pattern.
Control statements lots of options; can get
involved.

IEBPTPCH
//SYSIN DD *
PRINT
MAXFLDS=n
TITLE ITEM=(MY DATA,20)
title and
col. to start it in
RECORD FIELD=(80) contiguous 80 byte
record, no spaces
/*
9

IEBPTPCH
Control statements are free form, columns
2 71.
Order in which control statements must
appear...

10

IEBPTPCH
1) PRINT:
Has many operands that can go in any order.
These operands refer to the entire data set or
pds mem; there are other statements that refer
to selected fields.
Code a comma after each operand on the print
card.

11

IEBPTPCH
TYPORG=PS or PO,
ps=sequential po=pds

TOTCONV=XE or PZ,
xe=all hex.
pz used on packed fields that are converted to
unpacked.
If data not packed and you specify PZ, you get garbage.
This conversion can be overriden by Record statements
for the same data.

12

IEBPTPCH
CNTRL=1 or n
Line spacing.

STARTAFT=n
Skip 1st n lrecls in qsam or each pds mem.

STOPAFT=n
Stop after printing n lrecls.

13

IEBPTPCH
MAXNAME=n
Number of subsequent member statements.
You must count them and put the number in here.
If omitted and there are subsequent member
statements, operation is terminated.

MAXFLDS=n
Number of subsequent field statements.
Required if field statements are used.

14

IEBPTPCH
2) TITLE used to request title and subtitle;
2 title statements MAX per ptpnch operation.
TITLE ITEM=(LITERAL,40), comma for
ITEM=(LITERAL,60)
continuation
TITLE ITEM=(BANK REPORT,35) 2 lines
with center
heading
TITLE ITEM=(NAME,10),ITEM=(ADDRESS20), and col
headers
ITEM=(BALANCE,45),ITEM=(LOAN NUMBER,60)

15

IEBPTPCH
3) MEMBER NAME=
Supply PDS member name to be printed.
If omitted when printing a pds, it prints all
members.
Any number of these allowed.
Must specify TYPORG=PO if printing pds
members because default is PS.

16

IEBPTPCH
All RECORD statements that follow a
MEMBER statement pertain to the member
indicated in the member statement.
If no RECORD statements follow, the member
is printed with the default conditions.

17

IEBPTPCH
4) RECORD to define a group of records that are to be
edited identically.
RECORD FIELDS=(length,input col.,conversion,output col.)

length = length of input field.


input col = where this fields begins.
conversion = PZ or XE.
Convert packed to decimal or convert alphameric to hex.

count the number of field statements used and fill in


MAXFLDS= on print statement.
e.g.,...

18

IEBPTPCH
Input Record
Name pic x(20)
Sales pic 9(5) comp-3.
(3 bytes)

Output Needed
Sales cols 1 5
3 blanks, then name
in cols 9 29

19

IEBPTPCH
RECORD FIELD=(20,1,,9),
FIELD=(3,21,PZ,1)

Omit conversion,
code comma, and
code a continuation
comma at end.

3 byte input,
convert packed
to decimal

20

IEBPTPCH
RECORD IDENT=(length,literal,input-location)
Length cant be greater than 8.
Lets you identify a delimiting record that is the last one to
which Field specifications apply.
Input-location col number where this string starts.

21

IEBPTPCH
RECORD IDENT=(5,ZZZZZ,1), Use following 3 field
FIELD=(-------),
statements on all records up to
FIELD=(-------),
& including the one wh/ has 5
FIELD=(-------)
Zs beginning in col. 1.
RECORD IDENT=(2,**,10),
Process subsequent recs
FIELD=(-----),
using ff 2 field stments until
FIELD=(-----)
find rec w/ 2 *s beginning in col. 10.
22

IEBPTPCH
Use of IDENT requires MAXGPS=n on Print
statement. n can be >= number of IDENT
parms found.
Use of literals in IDENT requires MAXLITS=n
on print statement. n is a number >= total
number of characters used in literals.
Example, print selected members of a PDS...
23

IEBPTPCH
PRINT MAXNAME=3,MAXFLDS=3,TYPORG=PO
MEMBER NAME=DOG
RECORD FIELD=(-----),
FIELD=(-----)
MEMBER NAME =CAT prints with defaults
MEMBER NAME =FROG
RECORD FIELD=(80) same as FIELD=(80,1,,1)
24

IEBPTPCH
Example, to print the directory of a PDS:
on SYSUT1 DD card, specify a DCB with
RECFM=U,BLKSIZE=256,LRECL=256
PRINT TYPORG=PS
for directory printing

25

IEBPTPCH
Printpunch RCs:

0 = OK
4 = qsam set does not exist or is empty
8 = pds is there but requested member is not
12 = unrecoverable error

26

IEBGENER
A copy utilty.
Can copy (change) qsam file to pds
member.
Can create backups of qsam files or pds
members.
Can copy from tape to disk or disk to disk.

27

IEBGENER
In the process of copying, you can also:
Change the physical organization of a dataset
E.g., change lrecl and blksize, make a qsamfile into
a pds member or members by using control
statements to divide up the records in a data set,
then assign these divisions as distinct members in a
pds.

Do some minor editing (e.g., zoned fields to


packed & vice versa).
28

//STEPn EXEC PGM=IEBGENER


//SYSPRINT DD SYSOUT=*
for utility messages
//SYSUT1 DD DSN=qsam file or a PDS or
instream data (input)
//SYSUT2 DD DSN= to the printer or to a qsam
file or to a
new or old PDS (output) If PDS is
old, code
DISP=(MOD,KEEP)
//SYSIN DD * for instream control statements
//SYSIN DD DUMMY
if output is sequential and no editing
involved
//SYSIN DD DSN=name of file with control statements; usually a
PDS member

IEBGENER
To copy instream data to a qsam disk file...

30

//STEPn EXEC PGM=IEBGENER


//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY (sequential to sequential, no editing)
//SYSUT1 DD *
...
Data
...
//SYSUT2 DD DSN=Z12345.DATAFILE,DISP=(NEW,KEEP),
// VOL=SER=ACA103,UNIT=DISK,SPACE=(TRK,(2,1)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=1600)

IEBGENER
Note: Sysut1 (the input) already has a DCB
associated with it because the file already
exists.
Sysut2 (the output) has no DCB information
associated with it (unless youre copying a
new member into an existing PDS).
The utility will use Sysut1s DCB info if you do
not specify info for Sysut2. Be careful!
32

IEBGENER
Suppose you have:
//SYSIN DD *
. . . if the instream data contains
instream data JCL, the copy operation
. . . probably will not succeed.
/*
33

IEBGENER
When theres JCL in the instream data, do
this...

34

//SYSIN DD DATA,DLM=ZZ
//JOBNAME JOB
//S1 EXEC IGYWCG
Delimiter chosen to end
//COB.SYSIN DD *
the instream data. Cannot
...
use typical delimiter of /*
source code
because the instream data
contains /*. Delimiter can
...
be any two characters.
/*
//GO.INPUT DD -----//GO.OUTPUT DD ----ZZ these characters end the instream data

IEBGENER
Control Statements:
Continuation of a line must begin in cols 4-16

GENERATE
Required when
output is to be partitioned
editing is to be performed

Must appear first.


36

IEBGENER
Operands on Generate:
MAXNAME=n
number of subsequent member
statements
MAXFLDS=n
number of subsequent field parameter
stments
MAXGPS=n
number of subsequent Ident
parameter
MAXLITS=n
same as with printpunch except
Maxlits pertains to the characters contained in field
literals of subsequent Record statements, not to literals in
Ident parameters

37

IEBGENER
MEMBER
Required when output is to be partitioned.
Use one per each member created.
It provides the name (and optional alias) of a
PDS member to be created.
If none appears, output is organized
sequentially.
E.g., MEMBER NAME=(realname,alias).
38

IEBGENER
RECORD
Identifies a record group; i.e., records that are
to be processed identically.
Required when output is partitioned or editing
is to be done.
Use RECORD IDENT=(length <=
8,literal,input col) to identify the last record to
be processed for a PDS member.
39

IEBGENER
Use RECORD FIELD=(length,literal or input
col,conversion,output col) to supply editing
information.
E.g., to produce a PDS with 3 members from
sequential input...

40

IEBGENER
//SYSUT1 DD DSN= name of sequentail input file
//SYSUT2 DD DSN= brand new PDS, supply space and
DCB info
//SYSIN DD * input control statements
GENERATE MAXNAME=3,MAXGPS=2
MEMBER NAME=MEM1
RECORD IDENT=(8,FIRSTMEM,1)
MEMBER NAME=MEM2
RECORD IDENT=(8,SECNDMEM,1)
MEMBER NAME=MEM3
41

IEBGENER
The Generate statement informs that three
member statements follow and that the
Ident parm appears twice.
First member is named mem1 and the last
record to be included in mem1 from the
input file has the string FIRSTMEM (8
bytes) appearing in column 1.
42

IEBGENER
Second member is named mem2 and the
last record to be included in mem2 from the
input file has the string SECNDMEM (8
bytes) appearing in column 1.
All of the remaining records in the input file
go into making up mem3.

43

IEBGENER
The Record Field statement provides field
processing and editing information:
RECORD FIELD=(length, lit or input col,conversion,output col)

Length
Length in bytes of the input field or literal to be
processed.
If not specified, 80 bytes assumed.
If literal to be processed, must be <= 40 bytes.
44

IEBGENER
Input col
Col 1 is assumed unless other wise specified.

Literal
Specifies a literal to be placed in the output file at
the specified location.

45

IEBGENER
Conversion
PZ convert packed decimal data to unpacked form.
ZP convert unpacked data to packed.

Output col
Specifies the column in the output file where the
field or literal is to go.

46

IEBGENER
Example, copy to a new sequential data set
from an old sequential data set, pack numeric
fields, block at 20
Input data set has following format: (40 bytes,
blocked at 10)

Code Pic x(9) cols 1-9


Name Pic x(20) cols 10-29
Acode Pic 9(4) cols 30-33
Phone Pic 9(7) cols 34-40

47

IEBGENER
//SYSUT1 DD DSN=OLDFILE, etc.
//SYSUT2 DD DSN=NEWFILE,UNIT=DISK,V=S=5,DISP=(NEW,KEEP),

// SPACE=(TRK,(2,1)),DCB=(LRECL=36,BLKSIZE=720,RECFM=FB)

//SYSIN DD *
GENERATE MAXFLDS=4
RECORD FIELD=(9,1,,1)
RECORD FIELD=(20,10,,10)
RECORD FIELD=(4,30,ZP,33)
RECORD FIELD=(7,34,ZP,33)
/*

copy code to col 1 in new file


copy name to col 10 in new file
4 byte acode, pack it, put in col 30
pack phone,put in col 33

48

IEBGENER
Note: 1st two statements could be replaced
with
RECORD FIELD=(30,1,,1)

Output file is 36 bytes long with:


alphabetic data in cols 1-29
packed acode in cols 30-32
packed phone in cols 33-36
49

DSD INPUT=(DATAIN),OUTPUT=(DATAOUT)
ddcards named above have corresponding JCL cards that describe these data sets, or input may be instream
FD NAME=SSN,LENGTH=9,STARTLOC=21,INPUT=DATAIN X
FROMLOC=1 nb: input= does not have to be specified if input parm is on create and dsd
FD NAME=PHONE,LENGTH=4,STARTLOC=30,X
PICTURE=7,P7531234,INDEX=123
FD NAME=NAME,LENGTH=20,STARTLOC=1,FORMAT=AN, X
ACTION=RP
FD NAME=FRESH,LENGTH=2,STARTLOC=34, X
PICTURE=2,FR
FD NAME=SOPH,LENGTH=2,STARTLOC=34, X
PICTURE=2,SO
REPEAT QUANTITY=2,CREATE=2
CREATE INPUT=DATAIN,QUANTITY=1,
X
NAME=(SSN,NAME,PHONE,FRESH)
CREATE INPUT=DATAIN,QUANTITY=1,
X
NAME=(SSN,NAME,PHONE,SOPH)
END

IEBCOPY
Performs maintenance on PDSs.
Main functions:

Copy a PDS (or selected members) from 1 PDS to another.


Replace or rename PDS members.
Exclude members from a PDS thats to be copied.
Copy a PDS to itself, reclaiming unused space (compress).
Unload a PDS to tape (called Unloading; PDS-> Seq).
Load a PDS to tape (called loading; Seq-> PDS).

51

IEBCOPY
DDNames:
Sysprint msg. data set
Sysut3 & sysut4 spill data sets (TRK(1,1))
1 or more anyname dd for input.
Cannot concatenate input; this specifies the
members to be copied, loaded, unloaded.

1 only dd name for output


Sysin control cards
52

IEBCOPY
Nb: Input and output will always be a PDS
unless youre doing loading/unloading, then
theyre sequential data sets on tape.
Control Cards:
Copy indicates beginning of a copy operation
Select specifies which input members are to be
copied
Exclude specifies which members are to be
excluded
53

IEBCOPY
COPY
beginning of copy operation.
may be more than one per invocation.
COPY OUTDD=DDNAME1,
INDD=DDNAME2
Outdd must be
on same line
as copy
54

IEBCOPY
This example copies everything from 2 to 1
except identically named members.
COPY OUTDD=DDOUT,
INDD=(DD1,DD2,DD3)
Input sets processed in same order as listed
here; i.e., all members from DD1, then
DD2, then DD3
55

IEBCOPY
This job will not copy identically named
members.
So if outset already has a member A, a member
named A from input will not get copied.

56

IEBCOPY
To copy identically named members, specify R.
INDD=((DD1,R)) note 2 sets of
or
parentheses
OUTDD=(DD3),
INDD=((DD1,R),DD2)
Now, any identically named members from DD1
pds will replace those with same name in DD3.

57

IEBCOPY
SELECT
Specifies members to be selected from input
dataset
Can also use to rename selected members in
output PDS
Must follow a Copy INDD statement, or an
INDD statement

58

IEBCOPY
COPY OUTDD=DD1,
INDD=DD2
SELECT MEMBER=(MEM1,MEM2,MEM3)

Copy only these three memberswill not


replace identically named.

59

IEBCOPY
SELECT MEMBER=((MEM1,R),MEM2,MEM3)
Guarantees MEM1 from input replaces any MEM1 in
output.
SELECT MEMBER=((MEM1,NEWMEM1[,R]),MEM2)
Copies mem1 and mem2, but renames mem1 as
newmem1.
SELECT MEMBER=((MEM1,,R)
Replaces, no new name.
60

IEBCOPY
When there is multiple input, the search for
members is as follows:
1st input specified is checked for mem1, mem2,
mem3
2nd specified input checked next.
Etc.
I.E., first input is checked first (totally ) for all
members, then 2nd input, etc.
61

IEBCOPY
If mem1 and mem2 found in 1st input and mem3
found in 2nd input, remaining input ignored.
Any other mem1s or mem2s in any other input
are ignored.

62

IEBCOPY
EXCLUDE
Specifies members to be excluded from the copy
operation.

EXCLUDE MEMBER=(MEM1,MEM2,MEM3)
Do not copy these members, but do copy the rest.

Examples...

63

IEBCOPY
Full Copy:
//S1 EXEC PGM=IEBCOPY
//SYSPRINT ----//INSET DD DSN=X,----------//OUTSET DD DSN=Y,-------//SYSIN DD *
COPY INDD=INSET
OUTDD=OUTSET
EXCLUDE MEMBER=(GARB1,GARB2)
64

IEBCOPY
Compress Job:
//ONEDD DD DSN=FULLPDS
//SYSIN DD *
COPY INDD=ONEDD
OUTDD=ONEDD

65

IEBCOMPR
Compares 2 seq. data sets of 2 PDSs at
LRECL level in order to, e.g., verify a
backup copy.
2 sequential data sets are identical if
they contain the same number of lrecls, and
records are identical

66

IEBCOMPR
If not identical, Compare will list
Names of DD statements that define the data
sets.
Record and block numbers.
The unequal records.
Max of 10 unequal records found.

67

IEBCOMPR
2 PDSs are identical if
Corresponding members contain same number
of records.
Records are identical.

Nb: to compare 2 PDSs, member names in


one must have corresponding matches in
the other
68

IEBCOMPR
JCL Cards:
EXEC SYSPRINT(MSGS)
SYSUT1 (input data set to compare)
SYSUT2 (input data set to compare)
SYSIN control cards or DUMMY if input sets
are sequential

69

IEBCOMPR
CARDS:
COMPARE TYPORG=PS|PO
required if input is PDSs
must be first if used
EXTS
identifies user exit routines to be used
LABELS
whether user labels are to be treated as data
70

IEHLIST
Will list the
Entrys in a catalog.
Entrys in the directory(s) of 1 or more PDSs
(max = 10).
Entrys in the VTOC.

Any number of listings can be requested in


a single execution of the program.
71

IEHLIST
JCL:
EXEC SYSPRINT
ANYNAMEDD
defines a permanently
mounted volume
(UNIT=DISK,VOL=SER=ACA10n,DISP=SHR)
SYSIN

72

IEHLIST
CARDS:
LISTCTLG
to request a listing of a catalog
LISTVTOC
to request a listing of the VTOC
LISTPDS
directory of one or more PDSs that
reside on same volume
LISTPDS DSNAME=(pdsname,pdsname)
(more than one OK if on same volume)
VOL=device=serial VOL=DISK=ACA10n
DUMP or
FORMAT
73

IEHLIST
Use FORMAT for a PDS created by linkage
editor
Use DUMP for all other PDSs

74

You might also like