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 a 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                               
/*                                                        

Note:

  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    
IEB167I FOLLOWING MEMBER(S) UNLOADED FROM INPUT DATA SET REFERENCED BY DD1
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:

COPY INDD=DD1,OUTDD=DD2
SELECT M=MEM1,MEM2
SELECT M=MEMA

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

If you are using zOS version 2.1 or later you can ignore this caution by simply changing the COPY statement in the above example to a COPYGROUP statement (abbreviated CP), any module aliases will then be automatically selected for copy along with the selected module.

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:

COPY INDD=DD1,OUTDD=DD2
SELECT M=MEM2,ALIAS2

Note:

  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 statements 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.
  3. If you are not unloading a dataset but simply copying members between datasets with different blocksizes you need to use the COPYMOD statement to allow re-blocking and have to also identify and select aliases using the method shown here.