Data and storage management on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


The IEBCOPY utility: Copy libraries (partitioned data sets)

Data and storage management on z/OS

IEBCOPY is a data set utility that is used to copy or merge members between one or more partitioned data sets, or partitioned data sets extended (PDSEs), in full or in part.

More specifically, this utility is commonly used for several purposes:

  • To copy selected (or all) members from one partitioned data set to another.
  • To copy a partitioned data set into a unique sequential format known as an unloaded partitioned data set. As a sequential data set it can be written on tape, sent by FTP, or manipulated as a simple sequential data set.
  • To read an unloaded partitioned data set (which is a sequential file) and recreate the original partitioned data set. Optionally, only selected members might be used.
  • To compress partitioned data sets (in place) to recover lost space.

Most z/OS® software products are distributed as unloaded partitioned data sets. The ISPF copy options (option 3.3, among others) uses IEBCOPY "under the covers." Moving a PDS or PDSE from one volume to another is easily done with IEBCOPY. If there is a need to manipulate partitioned data sets in batch jobs, IEBCOPY is probably used. Equivalent manipulation under TSO (using ISPF) uses IEBCOPY indirectly.

A simple IEBCOPY job might be the following:
//COPYJOB5 JOB 1,WAYNE,MSGCLASS=X
//         EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//SYSUT1   DD DISP=SHR,DSN=WAYNE.LIB.SOURCE
//SYSUT2   DD DISP=(NEW,KEEP),UNIT=TAPE,DSN=WAYNES.SOURCE,
//   VOL=SER=123456

This job will unload WAYNE.LIB.SOURCE (which we assume is a partitioned data set) and write it on tape. (The name TAPE is assumed to be an esoteric name that the local installation associates with tape drives.) By default, IEBCOPY copies from the data set defined by the SYSUT1 DD statement to the data set defined by SYSUT2 DD. For most utilities, SYSUT1 is the name used for the DD statement that defines the input data set, and SYSUT2 for the DD statement that defines the output data set. Notice that the data set name on tape is not the same as the data set name used as input (the same name could be used, but there is no requirement to do so).

The following job could be used to restore the PDS on another volume:
//COPYJOB6 JOB 1,WAYNE,MSGCLASS=X
//         EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//SYSUT1   DD DISP=OLD,UNIT=TAPE,DSN=WAYNES.SOURCE,
//   VOL=SER=123456
//SYSUT2 DD DISP=(NEW,CATLG),DSN=P390Z.LIB.PGMS,UNIT=3390,
//   SPACE=(TRK,(10,10,20)),VOL=SER=333333

In this example, IEBCOPY will detect that the input data set is an unloaded partitioned data set, which we determined would fit in about 10 tracks and should have 20 directory blocks.

Instead of using the DUMMY parameter on the SYSIN DD statement, you could substitute this JCL:
//SYSIN DD *
  COPY OUTDD=SYSUT2,INDD=SYSUT1
  SELECT MEMBER=(PGM1,PGM2)
/*

The SELECT statement specifies the member names to be processed, with the OUTDD and INDD parameters specifying the DD names to be used for output and input, respectively. You would have to use this JCL if you used names other than SYSUT1 and SYSUT2 for the input and output DD statements.

Restoring a partitioned data set from an unloaded copy automatically compresses (recovers lost space) the data set.





Copyright IBM Corporation 1990, 2010