z/OS utilities The MVS utilities that are presented in this chapter Name Function IEBGENER Copies or prints sequential data sets. IEHMOVE Copies or moves sequential data sets. IEBPTPCH Prints or punches the contents of sequential data sets. IEBCOPY Copies, merges, compresses, backs up, or restores partitioned data sets. IEHLIST Lists system information for PDS directories or VTOC entries. IEBCOMPR Compares the contents of sequential data sets. IEBDBG Generates test data. AMS commands that do similar functions Name Function REPRO Copies or moves VSAM or non−VSAM data sets. PRINT Prints the contents of VSAM or non−VSAM data sets. TSO commands and ISPF options that do similar functions Name ISPF option Function COPY 3.3 (Move/Copy utility) Copies a data set or member. LIST 1 (Browse) Displays the contents of a dataset or member. PRINTDS 3.6 (Hardcopy utility) Prints the contents of a data setor member. LISTCAT 3.4 (DSLIST utility) Lists catalog entries. LISTDS 3.2 or 3.4 (Data set or DSLISTutility) Lists data set information. DD statements typically required by an MVS utility ddname Use SYSPRINT Output messages or printed output. SYSUT1 The input file. SYSUT2 The output file. SYSIN The control statement file. The DD statements required by the IEBGENER utility ddname Use SYSPRINT An output message file. SYSUT1 The input file. SYSUT2 The output file. SYSIN The control statement file. A job step that uses IEBGENER to copy a sequential file //COPY EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSNAME=MM01.CUSTMAST,DISP=SHR //SYSUT2 DD DSNAME=MM01.CUSTMAST.BACKUP,DISP=(NEW,CATLG), // UNIT=SYSDA,SPACE=(CYL,(1,1)) //SYSIN DD DUMMY A job step that uses IEBGENER to print a sequential file //PRINT EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSNAME=MM01.CUSTMAST,DISP=SHR //SYSUT2 DD SYSOUT=* //SYSIN DD DUMMY A job step that uses IEBGENER to copy a sequential file with reformatting //COPY EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSNAME=MM01.CUSTMAST,DISP=SHR //SYSUT2 DD DSNAME=MM01.CUSTMAST.TEST,DISP=(NEW,CATLG), // UNIT=SYSDA,SPACE=(CYL,(1,1)), // DCB=(RECFM=FB,LRECL=40,BLKSIZE=800) //SYSIN DD * GENERATE MAXFLDS=5,MAXLITS=4 RECORD FIELD=(5,1,,1),FIELD=(20,21,,6),FIELD=(9,61,ZP,26), X FIELD=(9,70,ZP,31),FIELD=(4,'TEST',,36) /* A job step that copies the first 1000 records in a data set // EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //INDD DD DSNAME=MM01.CUSTMAST,DISP=SHR //OUTDD DD DSNAME=MM01.CUSTMAST.TEST,DISP=(NEW,CATLG), // UNIT=SYSDA,SPACE=(CYL,(1,1)), // DCB=(RECFM=FB,LRECL=40,BLKSIZE=800) //SYSIN DD * REPRO INFILE(INDD) − OUTFILE(OUTDD) − COUNT(1000) /* A job step that copies and renames a sequential file //COPYSEQ EXEC PGM=IEHMOVE //SYSPRINT DD SYSOUT=* //SYSUT1 DD UNIT=SYSDA,VOL=SER=WORK01,DISP=OLD //SYSRES DD UNIT=SYSDA,VOL=REF=SYS1.SVCLIB,DISP=OLD //DDUT1 DD UNIT=SYSDA,VOL=SER=TSO001,DISP=OLD //DDUT2 DD UNIT=SYSDA,VOL=SER=TSO002,DISP=OLD //SYSIN DD * COPY DSNAME=MM01.CUSTMAST,FROM=SYSDA=TSO001,TO=SYSDA=TSO002, X RENAME=MM01.CUSTOMER.MASTER /* A job step that moves and renames a partitioned data set with some exclusions //MOVEPDS EXEC PGM=IEHMOVE //SYSPRINT DD SYSOUT=* //SYSUT1 DD UNIT=SYSDA,VOL=SER=WORK01,DISP=OLD //SYSRES DD UNIT=SYSDA,VOL=REF=SYS1.SVCLIB,DISP=OLD //DDUT1 DD UNIT=SYSDA,VOL=SER=TSO001,DISP=OLD //DDUT2 DD UNIT=SYSDA,VOL=SER=TSO001,DISP=OLD //SYSIN DD * MOVE PDS=MM01.COPYLIB.COB,FROM=SYSDA=TSO001,TO=SYSDA=TSO001, X RENAME=MM01.COPYINV.COB EXCLUDE MEMBER=PRODMSTR EXCLUDE MEMBER=PROMSTR EXCLUDE MEMBER=BFREC EXCLUDE MEMBER=TRREC /* A job step that prints the first 100 records of a sequential data set //PRINT EXEC PGM=IEBPTPCH //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=MM01.CUSTOMER.MASTER,DISP=SHR //SYSUT2 DD SYSOUT=* //SYSIN DD * PRINT TYPORG=PS,TOTCONV=PZ,STOPAFT=100,MAXLINE=60 /* A job step that prints two members of a partitioned data set //PRINT EXEC PGM=IEBPTPCH //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=MM01.COPYLIB.COBOL,DISP=SHR //SYSUT2 DD SYSOUT=* //SYSIN DD * PRINT MAXNAME=2,MAXFLDS=2,TYPORG=PO MEMBER NAME=CUSTMAST RECORD FIELD(80) MEMBER NAME=ORDTRAN RECORD FIELD(80) /* A job step that prints a sequential data set //PRINT EXEC PGM=IEBPTPCH //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=MM01.CUSTOMER.MASTER,DISP=SHR //SYSUT2 DD SYSOUT=* //SYSIN DD * PRINT MAXFLDS=5 TITLE ITEM=('LISTING OF CUSTOMER MASTER FILE',20) RECORD FIELD(5,1,,1),FIELD(5,6,,8),FIELD=(20,11,,15), X FIELD(5,61,PZ,37),FIELD=(5,66,PZ,48) /* A job step that merges two partitioned data sets //MERGE EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //DDIN DD DSN=MM01.COPYLIBX.COB,DISP=OLD //DDOUT DD DSN=MM01.COPYLIB.COB,DISP=OLD //SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) //SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) //SYSIN DD * COPY OUTDD=DDOUT,INDD=DDIN /* A job step that compresses a partitioned data set //COMPRESS EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //COMPFILE DD DSN=MM01.COPYLIB.COB,DISP=OLD //SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) //SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1,1)) //SYSIN DD * COPY OUTDD=COMPFILE,INDD=COMPFILE /* A job step that lists VTOC entries //LISTVTOC EXEC PGM=IEHLIST //SYSPRINT DD SYSOUT=* //DDVOL1 DD UNIT=SYSDA,VOL=SER=TSO001,DISP=SHR //SYSIN DD * LISTVTOC VOL=SYSDA=TSO001 A job step that lists all the members in a partitioned data set //LISTPDS EXEC PGM=IEHLIST //SYSPRINT DD SYSOUT=* //DDVOL1 DD UNIT=SYSDA,VOL=SER=TSO001,DISP=SHR //SYSIN DD * LISTPDS DSNAME=SYS1.COBLIB,VOL=SYSDA=TSO001 A job that compares sequential data sets //COMPSEQ EXEC PGM=IEBCOMPR //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=MM01.CSTMAST1,DISP=SHR //SYSUT2 DD DSN=MM01.CSTMAST2,DISP=SHR //SYSIN DD DUMMY A job that compares partitioned data sets //COMPPDS EXEC PGM=IEBCOMPR //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=MM01.SRCLIB.P42A.COB,DISP=SHR //SYSUT2 DD DSN=MM01.SRCLIB.P43A.COB,DISP=SHR //SYSIN DD * COMPARE TYPORG=PO /* A job step that creates a sequential test file //CREATE EXEC PGM=IEBDG //SYSPRINT DD SYSOUT=* //DDOUT DD DSNAME=MM01.CUSTMAST.TEST,DISP=(NEW,CATLG), // UNIT=SYSDA,SPACE=(CYL,(1,1)), // DCB=(DSORG=PS,RECFM=FB,RECL=150) //SYSIN DD * DSD OUTPUT=(DDOUT) FD NAME=KEY,LENGTH=5,FORMAT=ZD,INDEX=1,CYCLE=5 FD NAME=CUSTNAME,LENGTH=26,FORMAT=AN,ACTION=RP FD NAME=ADDRESS,LENGTH=26,FORMAT=AN,ACTION=RP FD NAME=CITY,LENGTH=18,FORMAT=AN,ACTION=RP FD NAME=STATEZIP,LENGTH=7,PICTURE=7,'CA93711' FD NAME=YTDSALES,LENGTH=5,PICTURE=9,P'000123456' FD NAME=FILLER1,LENGTH=61,FILL='X' CREATE QUANTITY=125,FILL=X'00',NAME=(KEY,CUSTNAME,ADDRESS,CITY, X STATEZIP,YTDSALES,FILLER1) END /* The JCL for a job step that does a sort //SORT EXEC PGM=SORT //SORTLIB DD DSNAME=SYS1.SORTLIB,DISP=SHR //SYSOUT DD SYSOUT=* //SORTIN DD DSNAME=MM01.INVOICE.TRANS,DISP=SHR //SORTOUT DD DSNAME=MM01.INVOICE.TRANS.SORTED,DISP=(NEW,CATLG), // UNIT=SYSDA,VOL=SER=MPS8BV, // SPACE=(CYL,(10,5)) //SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(20,5)) //SYSIN DD * SORT FIELDS=(9,5,CH,A) /* The JCL for a job step that does a merge //SORT EXEC PGM=SORT //SORTLIB DD DSNAME=SYS1.SORTLIB,DISP=SHR //SYSOUT DD SYSOUT=* //SORTIN01 DD DSNAME=MM01.INVOICE.TRANS.APRIL,DISP=SHR //SORTIN02 DD DSNAME=MM01.INVOICE.TRANS.MAY,DISP=SHR //SORTIN03 DD DSNAME=MM01.INVOICE.TRANS.JUNE,DISP=SHR //SORTOUT DD DSNAME=MM01.INVOICE.TRANS.Q2,DISP=(NEW,CATLG), // UNIT=SYSDA,VOL=SER=MPS8BV, // SPACE=(CYL,(10,5)) //SYSIN DD * MERGE FIELDS=(9,5,CH,A) /* The JCL for the sequential update program when it’s written in COBOL //SEQUPDTE JOB (36512),MENENDEZ,NOTIFY=MM01 //INV2200 EXEC PGM=INV2200 //RCTTRAN DD DSNAME=MM01.INV.TRANS,DISP=SHR //OLDMAST DD DSNAME=MM01.INV.MASTER,DISP=SHR //NEWMAST DD DSNAME=MM01.INV.MASTER.NEW,DISP=(NEW,CATLG), // UNIT=SYSDA,VOL=SER=MPS8BV, // SPACE=(CYL,(10,5)) //ERRTRAN DD DSNAME=MM01.INV.TRANS.ERRORS,DISP=(NEW,CATLG), // UNIT=SYSDA,VOL=SER=MPS8BV, // SPACE=(CYL,(1,1)) //SORTLIB DD DSNAME=SYS1.SORTLIB,DISP=SHR A REXX procedure named MKTGTEST that runs a COBOL program /* REXX */ "ALLOCATE DDNAME(CUSTMAST) DSNAME(CUSTMAST.DATA)" "ALLOCATE DDNAME(SYSIN) DSNAME(*)" "ALLOCATE DDNAME(SYSOUT) DSNAME(*)" "CALL TEST(MKTG1200) PARM('JANUARY')" "FREE DDNAME(CUSTMAST SYSIN SYSOUT)" A REXX procedure named MKTGTEST that uses two variables /* REXX */ arg MasterDSN Parm "ALLOCATE DDNAME(CUSTMAST) DSNAME("MasterDSN".DATA)" "ALLOCATE DDNAME(SYSIN) DSNAME(*)" "ALLOCATE DDNAME(SYSOUT) DSNAME(*)" "CALL TEST(MKTG1200) PARM('"Parm"')" "FREE DDNAME("MasterDSN" SYSIN SYSOUT)" A REXX procedure for entering publication orders /* REXX */ say "Place your publication order" say say "Enter your employee number:" parse external EmpNo say "Enter your department number:" parse external DeptCode say do until Document="" say "Enter document−id and quantity (leave blank to end):" parse external Document Quantity if Document<>"" then queue EmpNo DeptCode Document Quantity end end queue "" "ALLOCATE DDNAME(ORDER) DSNAME(ORDER.DATA) MOD" "EXECIO * DISKW ORDER (FINIS)" if rc=0 then say "Your order has been placed" else do say "Your order could not be placed say "EXECIO error code " rc end "FREE DDNAME(ORDER)" An IKJEFT01 job that copies one HFS file to another //MM01HC JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=IKJEFT01 //SYSTSPRT DD SYSOUT=* //HFSCP DD PATH='/mm01/data/trans.data',PATHOPTS=ORDONLY //STDOUTL DD PATH='/mm01/data/trans.data.copy', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //SYSPRINT DD SYSOUT=* //SYSTSIN DD DATA ocopy indd(HFSCP) outdd(STDOUTL) /* An IKJEFT01 job that copies a PDS member to an HFS file //MM01MC JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=IKJEFT01 //SYSTSPRT DD SYSOUT=* //MEMDATA DD DSN=MM01.WORK.DATA(ORDER),DISP=SHR //HFSOUTL DD PATH='/mm01/data/order.file', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //SYSPRINT DD SYSOUT=* //SYSTSIN DD DATA ocopy indd(MEMDATA) outdd(HFSOUTL) /* An IKJEFT01 job that copies an HFS file to a sequential data set //MM01HS JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=IKJEFT01 //SYSTSPRT DD SYSOUT=* //HFSCP DD PATH='/mm01/data/trans.data',PATHOPTS=ORDONLY //DTAOUTL DD DSN=MM01.TRANS.DATA,DISP=(,CATLG,DELETE), // UNIT=SYSDA,SPACE=(TRK,(1,1)), // RECFM=FB,LRECL=80 //SYSPRINT DD SYSOUT=* //SYSTSIN DD DATA ocopy indd(HFSCP) outdd(DTAOUTL) /* A report program that accesses an HFS customer master file //MM01RN JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=RPT3000 //STEPLIB DD DSN=MM01.TEST.LOADLIB,DISP=SHR //CUSTMAST DD PATH='/mm01/data/customer.master',PATHOPTS=ORDONLY //SALESRPT DD SYSOUT=* //SYSOUT DD SYSOUT=* // A BPXBATCH job that executes a UNIX shell command //MM01BP1 JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=BPXBATCH,PARM='SH ls -l /mm01/data' //STDOUT DD PATH='/mm01/output/mm01bp1.out', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //STDERR DD PATH='/mm01/output/mm01bp1.err', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) // A BPXBATCH job that executes a UNIX shell script //MM01BP2 JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=BPXBATCH //STDIN DD PATH='/mm01/scripts/jcl.script', // PATHOPTS=ORDONLY //STDOUT DD PATH='/mm01/output/mm01bp2.out', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //STDERR DD PATH='/mm01/output/mm01bp2.err', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) // A BPXBATCH job that executes a Java program //MM01BP3 JOB (36512),'R MENENDEZ',NOTIFY=&SYSUID //STEP1 EXEC PGM=BPXBATCH,PARM='SH java /mm01/BookOrderApp' //STDOUT DD PATH='/mm01/output/mm01bp3.out', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //STDERR DD PATH='/mm01/output/mm01bp3.err', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRWXU,SIXGRP) //STDENV DD PATH='/mm01/envfil', // PATHOPTS=ORDONLY //