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.
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:
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".
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.
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: