How to Unload a PDS Using IEBCOPY

A partitioned dataset(PDS) directory can contain not just the names of the members within the PDS but other important information.

IEBCOPY UNLOAD copies the selected PDS members and their PDS directory information to a sequential dataset(PS) using a fixed format. This PS dataset (unloaded PDS or PDSU) is then easily stored on tape or transmitted to other sites.

Unloading an entire PDS

The following job will unload all members of an entire PDS. Even if the PDS is a loadmodule dataset you do not have to worry about aliases or anything else IEBCOPY will do it all for you (An alias is an alternate name by which the OS can invoke the same loadmodule either at the same or another entry point).

//S1 EXEC PGM=IEBCOPY                                     
//SYSPRINT DD SYSOUT=*                                    
//DD1  DD DISP=SHR,DSN=PDS_dataset_name            
//DD2  DD DSN=output_dataset,DISP=(NEW,CATLG),
//          SPACE=(TRK,(20,10),RLSE)             
//*         UNIT=unit,VOL=SER=volser  
//SYSIN  DD *                                             
    COPY INDD=DD1,OUTDD=DD2                               


  1. The IEBCOPY program reads the general instruction "COPY INDD= ...", it also checks the input and output DCB characteristics (DD1 and DD2) to know that this is a PDS UNLOAD.
  2. You will not be able to browse the output dataset. IEBCOPY will assign RECFM=VS and appropriate DCB block size values that are however unreadable by ISPF/PDF.

You can validate your unload through the IEBCOPY output that should look something like the following:

    COPY INDD=DD1,OUTDD=DD2                                             
IEB1013I COPYING FROM PDS   INDD=DD1      VOL=volume DSN=loadmodule_dataset
IEB1014I           TO PDSU OUTDD=DD2      VOL=volume DSN=output_dataset    
IEB154I MEMBER01 HAS BEEN SUCCESSFULLY UNLOADED                           
IEB154I MEMBER02 HAS BEEN SUCCESSFULLY UNLOADED                           
IEB154I MEM3     HAS BEEN SUCCESSFULLY UNLOADED                           
IEB154I MEM4     HAS BEEN SUCCESSFULLY UNLOADED                           

Note how IEBCOPY states the members have been "SUCCESSFULLY UNLOADED".

Unloading individual members from a PDS

Important: see the section below on "Caution: Selecting Members to Unload from Loadmodule PDSs" if this is what you intend doing.

When unloading individual members of a PDS the IEBCOPY COPY statement is refined by using the SELECT statement. This statement has lots of options for copying individual members with member rename or with replace if the member already exists. However this is not really applicable to unload actions and the COPY and SELECT need only be specified as follows:


Note how you can specify multiple member names on the SELECT statement and you can use as many SELECT statements as you wish.

Caution: Selecting Members to Unload from Loadmodule PDSs

When unloading loadmodule PDS members it is vitally important to SELECT all the directory entries for both the loadmoule you wish to unload and for each alias (alternate entry point name) associated with the loadmodule. Both the loadmodule name and the alias name(s) must be specified on IEBCOPY SELECT statements.

The easiest way to determine if your loadmodule has an alias is to browse the loadmodule PDS using ISPF. Once you have the member list use the line command 'SORT TTR' to change the list from name order to position on disk order. In this case the aliases will immediately follow the loadmodule to which they belong. You can recognise them as aliases since the Alias-of field will be complete e.g. after SORT TTR you might see:

  Menu  Functions  Utilities  Help                                            
BROWSE    SNYS.QA.LOADLIB                                   Row 00028 of 00067
Command ===>                                                  Scroll ===> CSR 
   Name     Prompt         Alias-of      Size       TTR      AC    AM     RM  
. MEM1                                 00000370    001F1F    01     31    ANY 
. MEM2                                 000058F8    002007    01     31     24 
. ALIAS2                   MEM2        000058F8    002007    01     31     24 
. MEM3                                 0000FA58    002016    01     31     24 

To unload only MEM2 from the above example we would use IEBCOPY control statements:



  1. If you have zOS Version 2.1 or higher then you can use the COPYGROUP statement (abbreviated CP) to copy loadmodules by name, IEBCOPY's COPYGROUP will then automatically copy any aliases. Important: This is not the same as the COPYGRP statement (abbreviated CG).
  2. If you are unloading a PDSE then you can use either the COPYGROUP or COPYGRP stements to unload program objects by name. In this case aliases (whose names may be longer than 8 characters in length) will also be automatically copied.