Mainframe Path Start learning free
Core10 min readLesson 2 of 3

Libraries, comparisons and volumes: IEBCOPY, IEBCOMPR, IEHLIST and ADRDSSU

IEBCOPY manages partitioned datasets, IEBCOMPR and SuperC tell you whether two files match, IEHLIST reads what is on a volume, and ADRDSSU moves and backs up data at the storage level. Each solves a different shape of problem.

IEBCOPY: the library utility

IEBCOPY copies members between PDS and PDSE libraries, unloads a library to a sequential file and reloads it, and compresses a PDS in place. It is how source, JCL and load libraries are copied between environments when no change-management tool does it for you.

Copy selected members, replacing existing ones (illustrative)
//COPYMEM  EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//FROMLIB  DD DSN=TEST.PAY.JCLLIB,DISP=SHR
//TOLIB    DD DSN=QA.PAY.JCLLIB,DISP=SHR
//SYSIN    DD *
  COPY OUTDD=TOLIB,INDD=FROMLIB
  SELECT MEMBER=((PAYRUN01,,R),(PAYRUN02,,R))
/*
IEBCOPY statementsWhat it means
COPY OUTDD=x,INDD=y
Copy from the library on DD y to the library on DD x; without SELECT, all members
SELECT MEMBER=(A,B)
Copy only the named members
(name,newname,R)
Optionally rename while copying; R means replace a member of the same name in the output
EXCLUDE MEMBER=(A)
Copy everything except the named members

Without R (or INDD=((y,R)) to replace all members), a member that already exists in the output is not replaced; IEBCOPY lists it in SYSPRINT and can still end with only a warning return code. That is a frequent reason a 'successful' promotion did not change anything.

Compressing a PDS

A PDS does not reuse space from deleted or replaced members. Over time it fills up and a save fails with an E37 space abend even though the library holds little live data. Copying the library onto itself (COPY OUTDD=LIB,INDD=LIB with one DD) compresses it. PDSEs reclaim space automatically and do not need compressing.

IEBCOMPR and SuperC: do these match?

IEBCOMPR compares two sequential datasets record by record, or two PDS libraries member by member. It ends RC 0 when the inputs are equal and RC 8 when they differ, reporting mismatched records in SYSPRINT. Its report is terse and byte-oriented, so in practice most people use SuperC, the ISPF compare utility (usually option 3.12, or batch program ISRSUPC), which produces a readable line-by-line difference listing.

Picking a compare tool
IEBCOMPR
Sequential files or librariesEqual or not equal (RC 0 or 8)Byte-level, terse reportGood for a pass or fail check in a job
SuperC
Sequential, PDS and PDSELine, word or byte compareReadable difference listingGood for reviewing code and output changes

IEHLIST: what is on a volume

IEHLIST reads directly from a disk volume rather than through the catalog. LISTVTOC lists the datasets in the volume table of contents, and LISTPDS lists a PDS directory. It needs a DD that allocates the volume itself.

List the VTOC of one volume (illustrative)
//LISTV    EXEC PGM=IEHLIST
//SYSPRINT DD SYSOUT=*
//VOL1     DD UNIT=3390,VOL=SER=WORK01,DISP=OLD
//SYSIN    DD *
  LISTVTOC FORMAT,VOL=3390=WORK01
/*

Most people now use ISPF 3.4 with a volume filter, or IDCAMS LISTCAT, for the same answers. IEHLIST is still useful when a dataset is on a volume but not in the catalog, the classic 'it exists but nobody can find it' problem.

ADRDSSU: storage-level copy and backup

ADRDSSU is the program behind DFSMSdss. It works below the level of records: it dumps datasets or whole volumes to tape or disk, restores them, copies datasets between volumes, and releases unused space. A logical dump selects datasets by name filters; a physical dump copies tracks from a volume.

CommandTypical use
DUMPBack up a set of datasets before a risky change, or a whole volume
RESTOREBring datasets back from a dump
COPYMove datasets to new volumes, for example during storage migrations
RELEASEFree over-allocated space at the end of datasets

ADRDSSU is normally run by storage administrators, and powerful options are protected by security profiles. Routine daily backup and migration is usually done by DFSMShsm, which calls DFSMSdss underneath; some sites use vendor products such as FDR from Innovation Data Processing instead. As a developer you are more likely to ask for a restore than to run one.

Common mistakes

Forgetting the replace option

IEBCOPY will not overwrite an existing member unless you ask. Code R on SELECT or INDD, and read SYSPRINT rather than trusting the return code alone.

Compressing a shared PDS in place

Concurrent updates during a compress can corrupt the directory. Get exclusive use, back up first, or move busy libraries to PDSE.

Using IEBCOMPR to review changes

IEBCOMPR only says equal or not, with a terse report. Use SuperC when a person needs to see what changed.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← How utilities work: IEFBR14, IEBGENER and IDCAMSDFSORT and ICETOOL in production →