Mainframes 360
The one stop destination for System Z professionals

Wednesday, July 8, 2009

IBM Utilities Tutorial – 02 : IEBCOPY

Q. What is IEBCOPY? How it is used?
IEBCOPY can be used to perform several functions on a PDS. It can Copy, Merge, Compress, Backup and Restore PDS datasets. When we use IEBCOPY, we must supply the COPY control statement to indicate the Input and Output datasets.

Depending on the Input Dataset and Output Dataset, IEBCOPY decides what to do. If it is a new output dataset, then IEBCOPY will copy source PDS to target PDS. If it is an old output dataset, then IEBCOPY will merge the members in input dataset with output dataset. If input dataset and output dataset are same, it compresses the dataset. IEBCOPY can be used to backup a PDS to a Tape Drive/DASD device. This is called as unloading. In case, the input is a tape drive sequential dataset, and output dataset is PDS, the process is called Loading(Restoring) the PDS – just the opposite of taking backup.
Q. How to COPY members one PDS to another using IEBCOPY?
IEBCOPY can be used to copy all members from one PDS to another, or selectively include and exclude certain members. Lets see, how we can copy from one PDS to another.

Output PDS to be created –> HERC04.OUTPUT.PDS

//   SPACE=(TRK,(1,1,1),RLSE),

The program to be executed is IEBCOPY, given in Job-step STEP01. The allocation,termination and all other messages related to the execution of the Job step should go to the default printer spool, so we keep SYSOUT=*.

- DDIN specifies the source PDS. Since, it is being read, the DISP parameter must be SHR.

specifies the target PDS. Since, it is going to be newly created, its DISP parameter must be (NEW,CATLG,DELETE).

- It is necessary to code the SPACE parameter. The SPACE parameter has the following general format :


It is important to mention directory blocks. DIRECTORY Blocks = 0 means that it is PS(Physical Sequential) file. DIRECTORY Blocks > 0 means, it is PDS(Partitioned Dataset).
<<Common Programming Error>>
Forgetting to write the DIRECTORY-BLOCKS parameter, results in I/O read error, IEB139I.


- COPY control parameter is given as instream JCL. Please note : COPY starts in column 2. There should be no spaces between DDOUT, and INDD.


Here, you will find below a snapshot of the Batch Job/JCL that I wrote on my Dell Laptop to copy from one PDS to another.

Copy from One PDS To another - Batch JOB/JCL


Q. How do I use SELECT/EXCLUDE control statement?
Lets say the Input PDS HERC04.INPUT.PDS contains 3 members – MEMBER1,MEMBER2,MEMBER3. Suppose, we would like to copy only two members MEMBER1 and MEMBER2 to the Output PDS HERC04.OUTPUT.PDS.

The syntax of the SELECT control statement is as follows :

SELECT MEMBER=<member> or SELECT MEMBER=(member1,member2,…)

If we want the members to be given new names in the target PDS,

SELECT MEMBER=((member1,newname1),(member2,newname2),…)

If we want to copy a selected list of members, and want to replace them, if they already exist in the output dataset, we must code R after the member names.

SELECT MEMBER=((member1,,R),(member2,,R),...)

Here’s the JCL, that uses the
SELECT control statement to copy a select list of members.

//HERC04I  JOB  A123,QUASAR                                    
//STEP01   EXEC PGM=IEBCOPY                                    
//SYSPRINT DD   SYSOUT=*                                       
//DDIN     DD   DSN=HERC04.INPUT.PDS,DISP=SHR                  
//   DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,                       
//   DCB=(RECFM=FB,DSORG=PO)                                   
//SYSIN    DD   *                                              
COPY OUTDD=DDOUT,INDD=DDIN                                    
SELECT MEMBER=(MEMBER1,MEMBER2)                               

The EXCLUDE statement works on the same lines. While copy from 1 PDS to another, we can specify which members to be excluded(not copied) by giving the EXCLUDE control statement. The syntax of the EXCLUDE control statement is as follows :

EXCLUDE MEMBER=(member1,member2,...)

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.