Thursday, January 20, 2011

The IEBCOPY

IEBCOPY is a dataset utility which used to copy or merge members between Partitioned datasets (PDS) or Partitioned datasets Extended (PDSE), fully or partially.

Common uses of IEBCOPY


1. Copy selected or all members of one PDS  into another.

2. Copy a Partitioned dataset into a unique sequential format known as “ Unloaded Partitioned dataset” which can be FTP, manipulate as a sequential dataset or written to Tape.

3. To read an unloaded Partitioned dataset or restore into a partitioned dataset.

4.Compress PDS( c ) in place to recover free space.
The ISPF copy options (3.3) use IEBCOPY under the cover. Moving a PDS or PDSE can be easily achieved by IEBCOPY.

Simple IEBCOPY job


//COPYJOB5 JOB SHIBU,REGION=1024K
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=PGMG.COBOL.SOURCE
//SYSUT2 DD DISP=(NEW,KEEP),UNIT=TAPE,DSN=ARCHIVE.SOURCE,
// VOL=SER=XXXXXX

SYSUT1 is the input dataset and SYSUT2 is the output dataset. The above job unload the SYSUT1 pds (PGMG.COBOL.SOURCE ) and write into TAPE, with the PDS name provided in SYSUT2.   
Note: In the above job output dataset name is not same as the input dataset name, however there is no harm in using the same name.

Job to Restore PDS in a volume.


//COPYJOB6 JOB SHIBU,MSGCLASS=X,REGION=1024K
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=OLD,UNIT=TAPE,DSN=ARCHIVE.SOURCE,
// VOL=SER=XXXXXX
//SYSUT2 DD DISP=(NEW,CATLG),DSN=PGMG.COBOL.SOURCE,UNIT=3390,
// SPACE=(TRK,(10,10,20)),VOL=SER=XXXXXX

This Job read unloaded partitioned dataset from TAPE and write the contents into vol XXXXXX, with the name provided in SYSUT1, 10 tracks and 20 Directory blocks.
We can also use the above job to move datasets from one volume into another with smaller changes.

//COPYJOB7 JOB 1,SHIBU,MSGCLASS=X,NOTIFY=&SYSUID           
//         EXEC PGM=IEBCOPY                               
//SYSPRINT DD SYSOUT=*                                    
//SYSIN    DD DUMMY                                       
//SYSUT1   DD DISP=OLD,DSN=PROD.PGMG.C,UNIT=3390,       
//   VOL=SER=VOL1                                       
//SYSUT2 DD DISP=(NEW,CATLG),DSN=SYSI.PGMG.C1,UNIT=3390,
//   SPACE=(TRK,(10,10,20)),VOL=SER=NEWVOL
               

Instead of using Dummy in the sysin we can specify additional selection criteria to IEBCOPY

E.g.
//SYSIN DD *
COPY OUTDD=SYSUT2,INDD=SYSUT1
SELECT MEMBER=(PGM1,PGM2)
/*

SELECT statement specifies the members to be processed with the job. If you have used any other ddnames for the datasets other than SYSUT1 or SYSUT2 then you can use OUTDD, INDD parameters to pass the dataset names.
Restoring a partitioned data set from an unloaded copy automatically compresses (recovers lost space) the data set.

No comments:

Post a Comment