Moving IAM Data Sets
There are several different software utilities that can be used to move IAM data sets. When IAM data sets are being moved along with many other data sets, for example as part of a reconfiguration, DASD backup and restore software, such as FDR or DFSMSdss from IBM are frequently used. Other related options are to move the data sets with FDRCOPY, or with FDRREORG.
Moving with FDRREORG
The best way from an internal data set structure and DASD space view point, is to move IAM data sets by performing data set reorganization. FDRREORG provides an excellent tool for moving IAM data sets to a different volumes. FDRREORG not only knows the basic file attributes, it also knows what IAM Overrides were used to create the original data set, and will pass those override values when defining the new data set. The other major alternative is to use IDCAMS REPRO, although that does involve more manual effort than FDRREORG.
Example A: Using FDRREORG to Move IAM Data sets
Shown below is an example of moving all of the IAM data sets from one volume to another. The NODEFAULTS keyword means that the selection criteria are based entirely on the control card input. The NOUPDATES=YES causes the data sets to be reorganized, even if there were no updates, inserts, or deletes. The IAMDEFINE=YES forces the delete and define of the IAM data sets. On the Select card, all IAM data sets are selected from one volume, and moved to another volume. The NEWALL keyword is required so that the new volume will be applied to all of the selected data sets.
Example of Using FDRREORG to Move IAM Data sets (EX1086A)
//SYSPRINT DD SYSOUT=*
//REORGPRT DD SYSOUT=*
//REORGRPT DD SYSOUT=*
//IAMINFO DD SYSOUT=*
//SYSIN DD *
REORG NODEFAULTS,NOUPDATES=YES,IAMDEFINE=YES
SELECT ALLDSN,DSTYPE=IAM,VOL=oldvol,
NEWVOLSDATA=newvol,NEWALL
/*
Example B: Using FDREPORT to Generate IDCAMS Control Cards
Another alternative automation technique for moving of IAM data sets by reorganization is to use FDREPORT. As demonstrated below FDREPORT can be used to create a data set containing control cards for IDCAMS for the following functions:
- Define an IAM data set on the new volume modeled from the original data set.
- Copy the original data set into the new data set.
- Delete the original data set.
- Rename the new data set to the original data set name.
- Do a LISTCAT on the moved data set.
If an error occurs, then the IDCAMS execution is stopped. The model control cards for each data set are specified by the data in the MASK DD input stream. By control card specifications to FDREPORT, only those IAM data sets are selected, that are single volume data sets cataloged to the volume that has been selected. One could get more sophisticated with the IF logic control cards created for IDCAMS, so that the processing could resume with the next data set, rather than stopping completely with the first error.
Example of using FDREPORT to Generate Control Cards for IDCAMS (EX1086B)
//SYSPRINT DD SYSOUT=*
//SYSPUNCH DD DSN=&&CAMS,UNIT=SYSDA,SPACE=(CYL,(2,1)),
// DISP=(,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=23440)
//SYSIN DD *
XSELECT DSORG=IAM,VOL=oldvol,CATALOG=YES,CATVOLCT=1
PUNCH FDRLIB=MASK
PRINT ENABLE=IAM,RPTYPE=SELPCH,SORT=NO
/*
//MASK DD *
DEFINE CLUSTER(NAME(<DSN>.NEW) -
MODEL(<DSN>) -
OWNER($IAM) -
VOL(newvol) )
IF MAXCC NE 0 THEN CANCEL
REPRO IDS(<DSN>) ODS(<DSN>.NEW)
IF MAXCC NE 0 THEN CANCEL
DELETE <DSN>
ALTER <DSN>.NEW NEWNAME(<DSN>)
IF MAXCC NE 0 THEN CANCEL
LISTCAT ENT(<DSN>) ALL
)SUFFIX
IF MAXCC NE 0 THEN CANCEL
/*
//MOVEIAM EXEC PGM=IDCAMS,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//IAMPRINT DD SYSOUT=*
//IAMINFO DD SYSOUT=*
//SYSIN DD DSN=&&CAMS,DISP=OLD
Example C: Moving Data Sets with FDRCOPY
FDRCOPY can also be used to move IAM data sets. The advantage of using FDRCOPY is that, all or a selected subset of data sets can be copied, regardless of type, in one job step. The disadvantage, as discussed above, is that IAM data sets will not be reorganized or reblocked. However, it is quite easy to use. In the following example, all non-VSAM data sets are being moved, which will include any IAM data sets.
Example of Moving Data sets with FDRCOPY (EX1086C)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
MOVE TYPE=DSF
SELECT ALLDSN,VOL=oldvol,NVOL=newvol
/*
Example D: Moving an IAM Data Set with FDRCOPY
You can also use FDRCOPY to move a single data set or group of IAM data sets. In the example below, a single IAM data set is moved with FDRCOPY to a new volume, as identified by the NVOL parameter.
Example of Moving Data sets with FDRCOPY (EX1086D)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
MOVE TYPE=DSF
SELECT CATDSN=my.iam.dataset,NVOL=newvol
/*
Example E: Moving Data Sets with DFSMSdss
A similar type of data set move function can also be accomplished with DFSMSdss. The move operation is effected by specifying the DELETE and RECATALOG(*) keywords on the control card. Non-VSAM data sets with organizations of sequential, partitioned, or direct are being moved. The AUTORELBLKA keyword is specified to make sure that IAM data sets with DSORG=DA are copied properly.
Example of Moving Data sets with DFSMSdss (EX1086E)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
COPY DATASET (INCLUDE(**) -
BY((DSORG EQ (SAM,PDS,BDAM)) (CATLG EQ YES)) ) -
LIDY((oldvol)) ODY((newvol)) -
DELETE RECATALOG(*) AUTORELBLKA
/*