IEBCOPY Utility (for Beginners)
IEBCOPY Utility (for Beginners)
Summary
For extensive information, go through the IEBCOPY Utility (for Experienced)
- IEBCOPY is a data set utility used to copy or merge members between one or more PDS or PDSEs. The copying can be full or partial.
- IEBCOPY is used to create a PDS backup and copy members from the backup into a PDS.
- IEBCOPY automatically lists the number of unused directory blocks.
- IEBCOPY lists the number of unused tracks available for members if the output data set is a PDS.
Syntax -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//Job-Card
//*
//STEP1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=...
//SYSUT2 DD DSN=...
//SYSUT3 DD UNIT=..
//SYSUT4 DD UNIT=..
//SYSIN DD *
control-statements
/*
- SYSPRINT - This is an optional DD statement. Utility programs use it for their output.
- SYSOUT - This is an optional DD statement. SYSOUT specifies a system-defined DD name for file status codes, system abend codes information, and the display statement output.
- SYSDUMP - This is an optional DD statement. The system uses it for dumping when an abend occurs.
- SYSUT01/any-ddname - This is an input DD statement and is mandatory. Multiple DD statements can be provided as input.
- SYSUT02/any-ddname - This is an output DD statement and is mandatory.
- SYSUT03/SYSUT04 - These are buffer memory DD statements for processing the task. These are optional.
- SYSIN - Contains the control statements for processing the task.
Return Codes -
- IEBCOPY returns a code in register 15 to specify the results of utility execution status.
- The return codes of IEBCOPY and the meanings are -
- 00 (X'00') - Successful completion.
- 04 (X'04') - One or more COPY or COPYGRP operations completed unsuccessfully or uncompleted.
Recovery may be possible for this case. - 08 (X'08') - An unrecoverable error exists. The utility ends.
Compress PDS -
- A PDS may contain unused areas where a deleted member or the old version of an updated member exists.
- The unused space is reused when a PDS is copied to a new data set or after a compress operation completes.
Practical Example -
Scenario - Compress a PDS.
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKC JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//***************************************************
//* COMPRESS THE PDS
//***************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=OLD
//SYSIN DD *
COPY OUTDD=SYSUT2,INDD=SYSUT1
/*
**************************** Bottom of Data ****************************
Job Status -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS
SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the PDS that needs to be compressed. - SYSIN DD - Has the control statements for processing the input.
- COPY OUTDD=SYSUT2,INDD=SYSUT1 - INDD, OUTDD should be same to compress it.
Convert PDS to PDSE -
- IEBCOPY can be used to convert PDS to PDSE.
- To convert a PDS to a PDSE, create a PDSE and copy the partitioned data set into the new PDSE. This task can accomplish with one use of IEBCOPY.
Practical Example -
Scenario - Convert PDS to PDSE.
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKE JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//***************************************************
//* CONVERT PDS TO PDSE
//***************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDSE,
// LIKE=MATEPK.IEBCOPY.INPPDS,DSNTYPE=LIBRARY,
// DISP=(NEW,CATLG,DELETE),
// UNIT=3390,VOL=SER=DEVHD4
**************************** Bottom of Data ****************************
Job Status -

Output -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS.
- SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDSE - Specifies the PDSE that needs to be created similar to PDS. IEBCOPY copies all the members from input PDS to new PDSE.
Copy Datasets -
- IEBCOPY is used to copy a PDS from one volume to another fully or partially.
- If the data set name changes, the new data set can be on the same volume.
Practical Example -
Scenario - Copy from one dataset to another resides on different volume.
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKC JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*****************************************************************
//* TO COPY PDS DATA SET ANOTHER PDS DATA SET ON DIFFERENT VOLUME
//*****************************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10,10),RLSE),
// UNIT=3390,VOL=SER=DEVHD4,
// DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
/*
**************************** Bottom of Data ****************************
Job Status -

Output -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS and resides on the volume STRVL2.
- SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,.. - Specifies the output new PDS and creating on the volume DEVHD4.
- COPY INDD=SYSUT1,OUTDD=SYSUT2 - Copies all members from SYSUT1 to SYSUT2. Both input and output datasets are on different volumes.
Unload Datasets -
- IEBCOPY is used to unload a PDS to a sequential data set.
- IEBCOPY re-creates PDS from an unloaded data set by specifying physical organization (DSORG=PO and DSNTYPE=PDS or DSNTYPE=LIBRARY) for the output data set.
Practical Example -
Scenario - Unload a PDS to a PS.
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKU JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//***************************************************
//* UNLOAD PDS TO PS
//***************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.UNLOADPS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// UNIT=3390,VOL=SER=DEVHD4
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
/*
**************************** Bottom of Data ****************************
Job Status -

Output -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS with members.
- SYSUT2 DD DSN=MATEPK.IEBCOPY.UNLOADPS,.. - Specifies the unload output PS.
- COPY INDD=SYSUT1,OUTDD=SYSUT2 - Unloads SYSUT1 data to SYSUT2.
Load from unload dataset -
- IEBCOPY is used to re-create a PDS from an unloaded copy of a sequential (unloaded) data set.
- IEBCOPY creates an unload data set by specifying physical organization (DSORG=PS) for the output data set.
Practical Example -
Scenario - Re-create or Load a PDS from unloaded PS.
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKL JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//***************************************************
//* RE-CREATE A NEW PDS FROM UNLOADED PS
//***************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.UNLOADPS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDS1,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10,10),RLSE),
// UNIT=3390,VOL=SER=STRVL2,
// DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD DUMMY
**************************** Bottom of Data ****************************
Job Status -

Output -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input unloaded PS file.
- SYSUT2 DD DSN=MATEPK.IEBCOPY.INPPDS1,.. - Specifies the new PDS that needs to create.
- SYSIN DD DUMMY - Load operation doesnt require control statements.
Note! We can't browse or view MATEPK.IEBCOPY.UNLOADPS because of not specifying the Block format. However, the member's data still resides.