Procedure for moving a data set with retained locks

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:

  1. Use the REPRO function of the access method services utility, then delete the original data set.
  2. 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.

Using the REPRO method

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:

  1. Create a new data set
  2. Copy (REPRO) the data from the old data set to the new
  3. Delete the old data set
  4. 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:

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

Using the EXPORT and IMPORT functions

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:

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)

Rebuilding alternate indexes

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:

  1. Issue SHCDS FRSETRR to indicate the data set is under maintenance.
  2. Issue SHCDS FRUNBIND to get VSAM to save the locks, to be re-applied after the rebuild.
  3. Delete and redefine the alternate index.
  4. Rebuild the alternate index (using BLDINDEX).
  5. Issue FRBIND to bind the retained locks to the newly built alternate index.
  6. Issue SHCDS FRRESETRR to unset the under-maintenance flag.
[[ Contents Previous Page | Next Page Index ]]