In this topic, we described about the Unload Datasets with detailed example.
IEBCOPY can be used to create a backup copy of a PDS by unloading (copying) it to a sequential data set on any storing device supported by QSAM. IEBCOPY creates an unload data set when physical sequential organization (DSORG=PS) specified for the output data set.
To create a PDS, specify DSORG=PO and DSNTYPE=PDS or DSNTYPE=LIBRARY. Do not change the DCB parameters of an unload data set after IEBCOPY finishes creating it, if the same dataset required to use again for reload with IEBCOPY.
IEBCOPY can copy a PDSU to a PDSU directly without the need to reload to a PDS. If a selective copy is not required then IEBGENER can be faster to copy the PDSU to a new PDSU.
Only a COPY operation can create an unload data set and COPYMOD operation cannot. To unload more than one PDS to the same tape volume in one execution of IEBCOPY, multiple copy operations and multiple sequential data sets must be used.
A PDS is unloaded to a tape volume to create a backup copy of the data set.
//SAVE JOB ... //STEP1 EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=PARTPDS,UNIT=disk,VOL=SER=VOL001, // DISP=OLD //SYSUT2 DD DSNAME=SAVDATA,UNIT=tape,VOL=SER=TAPE03, // DISP=(NEW,KEEP),LABEL=(,SL) //SYSIN DD DUMMY
Let’s discuss the example in detail.
- SYSUT1 DD defines a PDS (PARTPDS) that resides on a disk volume and is assumed to have 700 members. The number of members is used to calculate the space allocation on SYSUT3.
- SYSUT2 DD defines a sequential data set to hold PARTPDS in unloaded form. Block size information can optionally be added; this data set must be NEW.
- SYSUT3 DD defines the temporary spill data set.
- The SYSUT4 data set is never used for an unload operation.
- SYSIN DD defines the control data set. Because SYSIN is dummied and SYSUT2 defines a sequential data set, all members of the SYSUT1 data set will be unloaded to the SYSUT2 data set.