This topic outlines some procedures to follow when moving a data set
from one location on DASD to another.
There are two basic methods that you can use to move a VSAM data set:
- Use the REPRO function of the access method services utility, then delete the original data set.
- Use the EXPORT and IMPORT functions of access method services.
With either of these methods, you need to take extra steps to preserve
any retained locks for data sets accessed in RLS mode.
If the recoverable data set you want to move has not been used in RLS mode,
you can simply use access method services commands to:
- Create a new data set
- Copy (REPRO) the data from the old data set to the new
- Delete the old data set
- Rename the new data set back to the old
In the case of a non-RLS mode data set, retained locks are not a problem
and no other special action is needed.
The following access method services examples assume that CICS®.DATASET.A needs
to be redefined and the data moved to a data set named CICS.DATASET.B,
which is then renamed:
DEFINE CLUSTER (NAME(CICS.DATASET.B) ...
REPRO INDATASET(CICS.DATASET.A) OUTDATASET(CICS.DATASET.B)
DELETE CICS.DATASET.A
ALTER CICS.DATASET.B NEWNAME(CICS.DATASET.A)
If the recoverable data set has associated RLS locks, these steps are not
sufficient because:
- The REPRO command copies the data from CICS.DATASET.A to CICS.DATASET.B but leaves the locks associated
with the original data set CICS.DATASET.A.
- The DELETE command deletes both the original data set and its associated
locks.
- After you issue the ALTER command, the data set has been moved but the
new data set does not have any associated locks, which have been lost when
you deleted the original data set.
To enable you to move data and keep the locks associated with the data,
access method services provide the following SHCDS subcommands. These are
subcommands of the VSAM sharing control SHCDS command, and must always be
preceded by the SHCDS keyword:
- SHCDS FRSETRR
- This command marks the data set as being under maintenance, by setting
a flag in the data set’s ICF catalog entry. (This flag is shown as ‘Recovery
Required’ in a catalog listing (LISTCAT).)
- SHCDS FRUNBIND
- This command unbinds any retained locks held against the data set. The
locks are no longer associated with any specific disk location or data set.
- SHCDS FRBIND
- This command re-binds to the new data set all retained locks that were
unbound from the old data set. The locks are now associated with the named
data set. The data set name used in FRBIND must match the name used in the
earlier FRUNBIND.
- SHCDS FRRESETRR
- This frees the data set from being under maintenance, resetting the
flag in the ICF catalog.
Based on the above example of using REPRO to move a VSAM data set, the
complete solution for a data set accessed in RLS mode, and which preserves
the RLS locks, is as follows.
- 1. Quiesce the data set
- Quiesce the data set that is being moved, to prevent access by CICS regions while
maintenance is in progress.
- 2. Create a new data set
- Create a new data set into which the data is to be copied. At this stage,
it cannot have the same name as the old data set. For example:
DEFINE CLUSTER (NAME(CICS.DATASET.B) ...
- 3. Issue SHCDS FRSETRR
- Use this access method services (AMS) SHCDS subcommand to mark the old
data set as being under maintenance. This makes the data set unavailable while
the move from old to new is in progress, and also allows the following unbind
operation to succeed. For example:
SHCDS FRSETRR(CICS.DATASET.A)
- 4. Issue SHCDS FRUNBIND
- Use this SHCDS subcommand to unbind any retained locks against the old
data set. This enables SMSVSAM to preserve the locks ready for re-binding
later to the new data set. For example:
SHCDS FRUNBIND(CICS.DATASET.A)
Note:
You can include the SHCDS FRSETRR and FRUNBIND subcommands
of steps 3 and 4 in the same IDCAMS execution, but they must be in the correct
sequence. For example, the SYSIN input to IDCAMS would look like this:
//SYSIN DD *
SHCDS FRSETRR(old_dsname)
SHCDS FRUNBIND(old_dsname)
/*
- 5. Copy (REPRO) the data
- After the unbind, use REPRO to copy the data from the old data set to
the new data set created in step 1. For example:
REPRO INDATASET(CICS.DATASET.A) OUTDATASET(CICS.DATASET.B)
- 6. SHCDS FRSETRR
- Use this SHCDS subcommand to mark the new data set as being under maintenance.
This is necessary to allow the later (step 8) re-bind operation to succeed.
For example:
SHCDS FRSETRR(CICS.DATASET.B)
- 7. Delete the old data set
- Delete the old data set to enable you to rename the new data set to
the name of the old data set. For example:
DELETE CICS.DATASET.A
- 8. Alter the new data set name
- Use access method services to rename the new data set to the name of
the old data set. For example:
ALTER CICS.DATASET.B NEWNAME(CICS.DATASET.A)
You must give the new data set the name of the old data set to enable
the following bind operation to succeed.
- 9. FRBIND
- Use this SHCDS subcommand to re-bind to the recovered data set all the
retained locks that were unbound from the old data set. For example:
SHCDS FRBIND(CICS.DATASET.A)
- 10. FRRESETRR
- Use this SHCDS subcommand after the re-bind to reset the maintenance
flag and enable the data set for use. For example:
SHCDS FRRESETRR(CICS.DATASET.A)
Note:
You can include the SHCDS FRBIND and FRRESETRR subcommands
of steps 8 and 9 in one IDCAMS execution, but they must be in the correct
sequence. For example, the SYSIN input to IDCAMS would look like this:
//SYSIN DD *
SHCDS FRBIND(dataset_name)
SHCDS FRRESETRR(dataset_name)
/*
Similar considerations to those for the REPRO method also apply to the
use of IMPORT when recovering data from a copy created by EXPORT. The following
steps are required to restore a data set copy that has been created by an
access method services EXPORT command:
- Create a new empty data set into which the copy is to be restored, and
use IMPORT to copy the data from the exported version of the data set to the
new empty data set.
- Use SHCDS FRSETRR to mark the original data set as being under maintenance.
- Use SHCDS FRUNBIND to unbind the locks from the original data set.
- Use SHCDS FRSETRR to mark the new data set as being under maintenance.
- Delete the original data set.
- Rename the new data set back to the old name.
- Use SHCDS FRBIND to associate the locks with the new data set.
- Use SHCDS FRRESETRR to take the data set out of maintenance.
An example follows of the access method services commands used to restore
a portable copy of a data set created by EXPORT. The example assumes that
EXPORT has been used to create a copy of data set CICS.DATASET.A and that an empty data set
with the correct VSAM characteristics called CICS.DATASET.B has been created into which
the data will be imported.
IMPORT INTOEMTPTY INDATASET(CICS.DATASET.A.COPY) OUTDATASET(CICS.DATASET.B)
SHCDS FRSETRR(CICS.DATASET.A)
SHCDS FRUNBIND(CICS.DATASET.A)
SHCDS FRSETRR(CICS.DATASET.B)
DELETE CICS.DATASET.A
ALTER CICS.DATASET.B NEWNAME(CICS.DATASET.A)
SHCDS FRBIND(CICS.DATASET.A)
SHCDS FRRESETRR(CICS.DATASET.A)
If you delete and rebuild an alternate index (using BLDINDEX) it is equivalent
to moving the alternate index data set. It is possible that VSAM might be
holding locks on a unique key alternate index when you want to delete and
rebuild an alternate index. In this case, ensure that you preserve the locks
over the delete and rebuild process by setting ‘Recovery Required’
and transferring the locks to the rebuilt index. The steps you need to preserve
the locks across a rebuild are:
- Issue SHCDS FRSETRR to indicate the data set is under maintenance.
- Issue SHCDS FRUNBIND to get VSAM to save the locks, to be re-applied after
the rebuild.
- Delete and redefine the alternate index.
- Rebuild the alternate index (using BLDINDEX).
- Issue FRBIND to bind the retained locks to the newly built alternate index.
- Issue SHCDS FRRESETRR to unset the under-maintenance flag.
[[ Contents Previous Page | Next Page Index ]]