VSAM Recovery

VSAM files are typically used by on-line transaction based applications. VSAM files used by a DBMS can use the DBMS forward recovery process. VSAM files driven by CICS need traditional backup methods that involve bringing the systems down at some point overnight, then copying the data off to tape. If the file gets deleted or corrupted, then all transactions made since the backup are lost. As this is unacceptable to businesses today, VSAM updates are often recorded in transaction logs, so the file can be rolled forward to the point of failure. Recovery usually involves a restore from the latest backup, then a rollforward through the logs. These processes are discussed below.

After an abend, VSAM close errors might result in the HURBA being higher than the HARBA, the data and index components might have different time stanps, or the file might be left in OPEN status. These are all mismatch problems between the catalog and the VSAM file. They can usually be fixed by running a VERIFY against the file, as this will reset the catalog and synchronise it again. It may be worth following the VERIFY with an EXAMINE, just to make sure that the file has no structural issues.
You can get index problems with KSDS files; RBA errors in the high level index will affect direct access, while RBA errors in the sequence set will affect sequential access. It is worth trying a REPRO reorganisation in this case, as a REPRO will rebuild the index and so fix inconsistencies. You should also try to find out why the index became corrupt, most likely down to a task that used incorrect sharing options. Examine your SMF 62 and 64 records to find out what has been accessing and updating the file.

Basic Recovery from backup

DFDSS recovery

Any successful restore depends on a good backup first. With DFDSS, it is probably best to specify the parameters SELECTMulti(first) and Sphere to get good VSAM backups.
Selectmulti(first) means that if this is the first portion of a multi-volume dataset, then DFDSS will go out and find all the other portions and dump them together. An alternative is Selectmulti(any), which means that if the volume contains any portion of a multi-volume file, DFDSS will find and backup the complete file. This can be expensive if you have a lot of multi-volume files spread over lots of disks, as you will end up taking multiple backups of each file.
Sphere means dump all portions of a VSAM file, including alternate indexes and paths.

If you do the backup correctly, you should be able to just do a standard dataset restore specifying the VSAM cluster name, as long as you also specify SPHERE to get all the associated AIX clusters and paths back too. If the cluster was dumped without SPHERE, then you need to restore any Alternate Indexes as seperate clusters, and build the paths with IDCAMS commands.

FDRABR recovery

FDRABR will handle single volume VSAM files easily. you simply select the file you want to restore using the base cluster name. FDRABR will then restore all parts of the file, including alternative indexes, but FDRABR will not restore paths. You need to do that yourself using IDCAMS. The command is

DEFINE PATH ( NAME(aix.cluster.name.PATH) )

Multi-volume restores are a bit harder. If you have multi-volume datasets, its your responsibility to make sure that all the volumes are dumped at the same time, so all the parts are consistent.
If the backup is ok, then a restore should be as simple as

SELECT DSN=cluster.name

FDRABR should then go away, work out which volume backups it needs, dynamically mount the tapes, dynamically mount the output volumes, and restore the cluster. You need the same number of output volumes as the original file, with sufficient space on each. FDRABR restores each part of the file as a physical sequential, with a temporary volser ####Vx. Once it restores the last part, it catalogs the file up correctly as VSAM, with the correct volsers.

If the restore fails, then the 'VSAM special considerations' section of the FDR manual will assist.

VSAM Forward Recovery

VSAM files can be defined as 'Recoverable' or 'Non-recoverable'. A recoverable VSAM data set needs a recoverable subsystem like CICS, that provides logging for the data set. A recoverable data set is defined by the LOG(UNDO/ALL) attribute in the catalog. A recoverable data set must be accessed by a system that can run two-phase commit and backout of failed updates. A non-recoverable data set is a VSAM data set for which no logging is required. A non-recoverable data set is defined with the LOG(NONE) attribute in the catalog.

If you record all updates to a VSAM file in a separate log, and timestamp those updates, then you can use a technique called 'Forward Recovery' to get the file back to any point in time. CICS, the IBM transaction monitor, records transaction logs. If you use raw VSAM and want to recover to a point in time, you may need a third party product to provide logging facilities. The basic requirements for VSAM forward recovery are -

A Recovery Point, which is a time at which you took a full backup of all your VSAM datasets using one of the techniques above. This provides you with a backup copy of the whole file, which you should take at regular intervals, daily or possibly weekly.

A Journal is a chronologically ordered list of all the changes made to datasets since a Recovery Point. The Journals (or Logs) will only contain updates made to the file. You can write CICS journals to disk or tape, and write to a single file, or flip between files. Single files are easier to maintain, but will fill up quickly if there is a lot of update activity. Journal management is used to keep track of multiple files, and present them to the recovery program in the right order.

Forward recovery is a two stage process. First the dataset is backed out to the position it was in at the recovery point by restoring backup copies. Secondly all dataset changes that have been journalled since the recovery point are applied.

CICS VSAM Recovery (CICSVR) from IBM

The name CICSVR is a bit misleading, as the product works independently of CICS. It can recover KSDS, ESDS and RRDS files. You use an ISPF interface to select the datasets you want to recover, then create the recovery jobs.
If the VSAM file was backed up using DFHSM, then CICSVR will use DFHSM to get the file back to the recovery point.
It then selects the CICS recovery logs, and applies them in the correct order.
Finally, CICSVR reruns any failed transaction backouts, to remove uncommitted updates.

CICSVR can recover several VSAM clusters in a single job. Information about backups is held in a CICSVR file called the recovery control data set RCDS).

BMC Recovery utility for VSAM (RUV)

RUV works in both batch and online environments. It does more than just forward recovery, it also provides backup, journal and log record management, and reporting facilities and it can backup VSAM files while they are open to CICS. It works with KSDS, ESDS, RRDS, and VRRDS VSAM files and their associated indexes and journals batch changes to VSAM files to enable forward and backout recoveries. Recovery of VSAM data sets is an automated process within the RUV environment. RUV collects and records recovery information; however, it is your responsibility to determine when recovery processing is needed and which data sets require recovery.

You can group file together into 'application groups' and request backup, restore, and recovery processes using these groups. You can recover groups of file using file masks, or you can simply supply the fully qualified file name.

RUV records backups and journals in its register. It automatically registers its own backups, and allows external backups to be registered too. It then automatically builds recovery JCL using its register.

The RUV backups facility can handle files that are open to CICS for updates, with integrity. It can also use hardware snapshot utilities to perform 'instant' backups, and can also perform 'instant' restores from these snapshots.

Fixing VSAM file components

To delete a VSAM file, you just delete the cluster entry, and all the components are deleted with it. You can either do this with an IDCAMS DELETE job, or simply type DEL against the VSAM cluster name on a 3.4 listing (this is explained in the Z/OS utility section)

If you have VSAM components without a cluster, then you can catalog them up using an IDCAMS RECATALOG command as below. You need to know the volumes that the uncatalogued components are held on


Alternatively you can delete the uncatalogued components using IDCAMS statements like

    VVR FILE(DD1) -
    VVR FILE(DD2) -

The TRUENAME is a Catalog record that relates a VSAM component to its cluster. Sometimes, usually after a failed attempt to delete a VSAM file, you can be left with an orphaned truename record in the catalog. If this happens you cannot recreate the file, you will get duplicate name failures if you try. The answer is to use IDCAMS DELETE with the TRUENAME parameter as below.


back to top

Managing VSAM files

Lascon updTES

I retired 2 years ago, and so I'm out of touch with the latest in the data storage world. The Lascon site has not been updated since July 2021, and probably will not get updated very much again. The site hosting is paid up until early 2023 when it will almost certainly disappear.
Lascon Storage was conceived in 2000, and technology has changed massively over those 22 years. It's been fun, but I guess it's time to call it a day. Thanks to all my readers in that time. I hope you managed to find something useful in there.
All the best