2. 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 IBM's sort utility. . 3. Utilities. Common tasks:SortingCopyin
2. 2 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 IBM’s sort utility.
3. 3 Utilities Common tasks:
Comparing 2 files (look for differences, IBM’s 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)
4. 4 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.
5. 5 IEBPTPCH Default output:
Unprintable chars (e.g., X’00’) 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).
6. 6 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.
7. //STEPn EXEC PGM=IEBPTPCH catalogued, so no job/steplib needed
//SYSPRINT DD SYSOUT=* prtpunch messages
//SYSUT1 DD DSN=input data set qsam or name of PDS
//SYSUT2 DD SYSOUT=* output device
//SYSIN DD DSN=data set containing control statements; qsam or pds mem
//SYSIN DD *
//SYSIN DD DUMMY if omitting control stments & going with defaults
8. 8 IEBPTPCH Basically, all utilities have this general pattern.
Control statements – lots of options; can get involved.
10. 10 IEBPTPCH Control statements are free form, columns 2 – 71.
Order in which control statements must appear...
11. 11 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.
12. 12 IEBPTPCH TYPORG=PS or PO,
TOTCONV=XE or PZ,
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.
13. 13 IEBPTPCH CNTRL=1 or n
Skip 1st n lrecls in qsam or each pds mem.
Stop after printing n lrecls.
14. 14 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.
Number of subsequent field statements.
Required if field statements are used.
15. 15 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=(‘ADDRESS’20), and col headers
16. 16 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.
17. 17 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.
18. 18 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.
19. 19 IEBPTPCH Input Record Output Needed
Name pic x(20) Sales cols 1 – 5
Sales pic 9(5) comp-3. 3 blanks, then name
(3 bytes) in cols 9 – 29
20. 20 IEBPTPCH RECORD FIELD=(20,1,,9), FIELD=(3,21,PZ,1)
21. 21 IEBPTPCH RECORD IDENT=(length,’literal’,input-location)
Length can’t 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.
22. 22 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=(-------) Z’s 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.
23. 23 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...
24. 24 IEBPTPCH PRINT MAXNAME=3,MAXFLDS=3,TYPORG=PO
MEMBER NAME =CAT prints with defaults
MEMBER NAME =FROG
RECORD FIELD=(80) same as FIELD=(80,1,,1)
25. 25 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
26. 26 IEBPTPCH Printpunch RC’s:
0 = OK
4 = qsam set does not exist or is empty
8 = pds is there but requested member is not
12 = unrecoverable error
27. 27 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.
28. 28 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).
29. //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
30. 30 IEBGENER To copy instream data to a qsam disk file...
31. //STEPn EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY (sequential to sequential, no editing)
//SYSUT1 DD *
. . .
. . .
//SYSUT2 DD DSN=Z12345.DATAFILE,DISP=(NEW,KEEP),
32. 32 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 you’re copying a new member into an existing PDS).
The utility will use Sysut1’s DCB info if you do not specify info for Sysut2. Be careful!
33. 33 IEBGENER Suppose you have:
//SYSIN DD *
. . . if the instream data contains
instream data JCL, the copy operation
. . . probably will not succeed.
34. 34 IEBGENER When there’s JCL in the instream data, do this...
35. //SYSIN DD DATA,DLM=ZZ
//S1 EXEC IGYWCG
//COB.SYSIN DD *
. . .
. . .
//GO.INPUT DD ------
//GO.OUTPUT DD -----
ZZ these characters end the instream data
36. 36 IEBGENER Control Statements:
Continuation of a line must begin in cols 4-16
output is to be partitioned
editing is to be performed
Must appear first.
37. 37 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
38. 38 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).
39. 39 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.
40. 40 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...
41. 41 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
42. 42 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.
43. 43 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.
44. 44 IEBGENER The Record Field statement provides field processing and editing information:
RECORD FIELD=(length, ‘lit’ or input col,conversion,output col)
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.
45. 45 IEBGENER Input col
Col 1 is assumed unless other wise specified.
Specifies a literal to be placed in the output file at the specified location.
46. 46 IEBGENER Conversion
PZ convert packed decimal data to unpacked form.
ZP convert unpacked data to packed.
Specifies the column in the output file where the field or literal is to go.
47. 47 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
48. 48 IEBGENER //SYSUT1 DD DSN=OLDFILE, etc.
//SYSUT2 DD DSN=NEWFILE,UNIT=DISK,V=S=5,DISP=(NEW,KEEP),
//SYSIN DD *
RECORD FIELD=(9,1,,1) copy code to col 1 in new file
RECORD FIELD=(20,10,,10) copy name to col 10 in new file
RECORD FIELD=(4,30,ZP,33) 4 byte acode, pack it, put in col 30
RECORD FIELD=(7,34,ZP,33) pack phone,put in col 33
49. 49 IEBGENER Note: 1st two statements could be replaced with
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
50. 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,P’7531234’,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’
CREATE INPUT=DATAIN,QUANTITY=1, X NAME=(SSN,NAME,PHONE,FRESH)
CREATE INPUT=DATAIN,QUANTITY=1, X NAME=(SSN,NAME,PHONE,SOPH)
51. 51 IEBCOPY Performs maintenance on PDS’s.
Copy a PDS (or selected members) from 1 PDS to another.
Replace or rename PDS members.
Exclude members from a PDS that’s 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).
52. 52 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
53. 53 IEBCOPY Nb: Input and output will always be a PDS unless you’re doing loading/unloading, then they’re sequential data sets on tape.
Copy – indicates beginning of a copy operation
Select – specifies which input members are to be copied
Exclude – specifies which members are to be excluded
54. 54 IEBCOPY COPY
beginning of copy operation.
may be more than one per invocation.
55. 55 IEBCOPY This example copies everything from 2 to 1 except identically named members.
Input sets processed in same order as listed here; i.e., all members from DD1, then DD2, then DD3
56. 56 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.
57. 57 IEBCOPY To copy identically named members, specify R.
INDD=((DD1,R)) note 2 sets of or… parentheses
Now, any identically named members from DD1 pds will replace those with same name in DD3.
58. 58 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
59. 59 IEBCOPY COPY OUTDD=DD1,
Copy only these three members…will not replace identically named.
60. 60 IEBCOPY SELECT MEMBER=((MEM1,R),MEM2,MEM3)
Guarantees MEM1 from input replaces any MEM1 in output.
Copies mem1 and mem2, but renames mem1 as newmem1.
Replaces, no new name.
61. 61 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.
I.E., first input is checked first (totally ) for all members, then 2nd input, etc.
62. 62 IEBCOPY If mem1 and mem2 found in 1st input and mem3 found in 2nd input, remaining input ignored.
Any other mem1’s or mem2’s in any other input are ignored.
63. 63 IEBCOPY EXCLUDE
Specifies members to be excluded from the copy operation.
Do not copy these members, but do copy the rest.
64. 64 IEBCOPY Full Copy:
//S1 EXEC PGM=IEBCOPY
//INSET DD DSN=X,-----------
//OUTSET DD DSN=Y,--------
//SYSIN DD *
65. 65 IEBCOPY Compress Job:
//ONEDD DD DSN=FULLPDS
//SYSIN DD *
66. 66 IEBCOMPR Compares 2 seq. data sets of 2 PDS’s 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
67. 67 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.
68. 68 IEBCOMPR 2 PDS’s are identical if
Corresponding members contain same number of records.
Records are identical.
Nb: to compare 2 PDS’s, member names in one must have corresponding matches in the other
69. 69 IEBCOMPR JCL Cards:
SYSUT1 (input data set to compare)
SYSUT2 (input data set to compare)
SYSIN control cards or DUMMY if input sets are sequential
70. 70 IEBCOMPR CARDS:
required if input is PDS’s
must be first if used
identifies user exit routines to be used
whether user labels are to be treated as data
71. 71 IEHLIST Will list the
Entrys in a catalog.
Entrys in the directory(s) of 1 or more PDS’s (max = 10).
Entrys in the VTOC.
Any number of listings can be requested in a single execution of the program.
72. 72 IEHLIST JCL:
ANYNAMEDD defines a permanently mounted volume
73. 73 IEHLIST CARDS:
LISTCTLG to request a listing of a catalog
LISTVTOC to request a listing of the VTOC
LISTPDS directory of one or more PDS’s that reside on same volume
(more than one OK if on same volume)
DUMP or FORMAT
74. 74 IEHLIST Use FORMAT for a PDS created by linkage editor
Use DUMP for all other PDS’s