The IDCAMS VERIFY command corrects the catalog and end-of-data information for a VSAM cluster (or alternate index) after abnormal termination or when the catalog is flagged. When a job abends, the system fails, or the job is cancelled while a VSAM file is open, the file may not be closed properly. The catalog can be left in a state that marks the dataset as possibly corrupt, and the high-used RBA (the "end of data" pointer) in the catalog may not match the actual data on disk. VERIFY compares the catalog with the physical cluster and updates the catalog so the dataset can be opened again and so the correct end-of-data is known. This page explains when to use VERIFY, the syntax (FILE(ddname) vs DATASET(name)), the RECOVER option, and how to use JOBCAT or STEPCAT when the cluster is in a user catalog without an alias.
Use VERIFY when the VSAM dataset was not closed normally or when the catalog entry is flagged. After VERIFY, the catalog is updated so that the high-used RBA and other metadata match the physical dataset, and the "corrupt" or "inconsistent" flag can be cleared. That allows programs to open the file again without getting open errors (e.g. return code 168). The following table lists common situations where VERIFY is needed.
| Situation | Description |
|---|---|
| Abnormal termination | Job abended, system failure, or operator cancel. The VSAM file was open and did not close normally. The catalog may be flagged and high-used RBA may be wrong. Run VERIFY so the catalog is corrected and the dataset can be opened again. |
| Catalog flagged | The catalog entry shows the dataset as possibly corrupt or inconsistent (e.g. open at termination). VERIFY compares the catalog with the physical cluster and updates the catalog so the flag is cleared and end-of-data is correct. |
| Open return code 168 | A program gets return code 168 when opening the VSAM file. This often means the catalog is flagged or the dataset was not closed properly. Run VERIFY (and RECOVER if needed) to fix the catalog state. |
| After restoring from backup | In some recovery procedures you restore a VSAM cluster from backup. The catalog may not match the restored data. VERIFY can correct the catalog so the high-used RBA and other metadata match the physical dataset. |
VERIFY does not change the record data on the volume. It updates the catalog (and possibly in-memory or on-disk control information) so that: (1) the high-used RBA in the catalog matches the actual end of valid data in the cluster, and (2) the catalog entry is no longer marked as inconsistent or corrupt. When a VSAM file is closed normally, the access method updates the catalog with the correct high-used RBA. When the job fails or is cancelled before close, that update may not happen. The catalog can then point to the wrong end-of-data or be flagged. VERIFY reads the physical cluster, determines the correct end-of-data, and writes the corrected information to the catalog. So VERIFY is a catalog-repair step, not a data-repair step. If the data itself was corrupted by the failure, you may need to restore from backup and then run VERIFY on the restored dataset.
You specify the cluster to verify in one of two ways: FILE(ddname) or DATASET(dataset-name). FILE(ddname) means the cluster is allocated via a DD statement in your JCL; you give the DD name. DATASET(dataset-name) means you give the full catalog name of the cluster. Use FILE when the cluster is in a user catalog and you allocate it via a DD that points to the cluster (often with STEPCAT or JOBCAT pointing to the user catalog). Use DATASET when the cluster is in the default catalog or when the name will resolve via JOBCAT/STEPCAT. There is no CATALOG parameter on VERIFY; to use a user catalog you must make it available with JOBCAT or STEPCAT.
| Form | When to use |
|---|---|
| FILE(ddname) | Use when the cluster is allocated via a DD statement. The ddname is the name of the DD in your JCL that points to the VSAM cluster. Use when you have JOBCAT/STEPCAT and the cluster is opened through that DD, or when you allocate the cluster by DSN= and a DD name. |
| DATASET(dataset-name) | Use when you refer to the cluster by its catalog name. The dataset-name is the full name of the cluster (e.g. MY.APPL.KSDS). The cluster must be in the catalog that the step uses (default catalog or one reached via JOBCAT/STEPCAT). |
| RECOVER | Optional. Tells VERIFY to attempt recovery of interrupted processing—completing or backing out incomplete updates and correcting the catalog and dataset. Use after abnormal termination when the dataset may be in an inconsistent state. |
1234VERIFY - { FILE(ddname) | DATASET(dataset-name) } - [ RECOVER ]
You must specify either FILE(ddname) or DATASET(dataset-name). RECOVER is optional. Continuation is with a hyphen at end of line. Example with FILE:
123456//STEPCAT DD DSN=USER.CATALOG,DISP=SHR //MYCLUST DD DSN=MY.APPL.KSDS,DISP=OLD //SYSIN DD * VERIFY FILE(MYCLUST) /*
Example with DATASET (cluster in default catalog):
12VERIFY DATASET(MY.APPL.KSDS)
Example with RECOVER after abnormal termination:
12VERIFY DATASET(MY.APPL.KSDS) RECOVER
If the VSAM cluster is in a user catalog and there is no alias that makes that catalog the default, the step must have access to the user catalog. Allocate the user catalog with a JOBCAT or STEPCAT DD. JOBCAT applies to the whole job; STEPCAT applies to one step. The DD typically has DSN=user-catalog-name and DISP=SHR. Once the catalog is available, you can use VERIFY DATASET(cluster-name) if the cluster name is cataloged in that user catalog, or VERIFY FILE(ddname) where the DD points to the cluster (and the cluster may be opened through the same or another catalog). If you omit JOBCAT/STEPCAT and the cluster is only in a user catalog, the step cannot resolve the name and VERIFY will fail. So when there is no catalog alias, always use JOBCAT or STEPCAT and then VERIFY with DATASET(name) or FILE(ddname) as appropriate.
1234567//STEP1 EXEC PGM=IDCAMS //STEPCAT DD DSN=MY.USER.CATALOG,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * VERIFY DATASET(MY.APPL.PROD.KSDS) /*
VERIFY is run per cluster. Verifying the base cluster does not verify its alternate indexes. If the base cluster was open at abnormal termination, run VERIFY on the base cluster. If an alternate index was also open (or if you are unsure), run VERIFY on each AIX that may have been affected. Each VERIFY command corrects one catalog entry (one cluster or one AIX). There is no single command that verifies the whole "sphere" (base plus all AIXs); you run VERIFY once for the base and once for each AIX as needed.
The RECOVER option tells VERIFY to attempt recovery of interrupted VSAM processing. That can include completing or backing out incomplete updates and correcting the catalog and dataset state. Use RECOVER when the dataset was left in an inconsistent state by abnormal termination—for example when a program was in the middle of an update or insert. After VERIFY RECOVER, you can run the EXAMINE command to check for remaining errors or damage. RECOVER may take longer than VERIFY without RECOVER because it does more work to restore consistency. See your IDCAMS documentation for the exact behavior of RECOVER on your system.
A successful VERIFY typically returns condition code 0 (or 4 in some cases). A non-zero return code indicates a problem—for example the dataset could not be opened, the catalog could not be updated, or the dataset was in an invalid state. VERIFY cannot be used on an empty VSAM file with a zero high-used RBA in some implementations; the documentation may say that the cluster must contain data. If your cluster is empty and you get an error, check whether your IDCAMS level allows VERIFY on empty clusters or whether you need to add at least one record before verifying.
When you close a drawer (VSAM file) properly, the label (catalog) gets updated to say where the last thing is. If someone knocks over the cabinet (abend) before you close the drawer, the label might be wrong. VERIFY is like checking the drawer and fixing the label so it says the right place again. You can point to the drawer by its name (DATASET) or by the little card that points to it (FILE). If the drawer is in a different filing room (user catalog), you have to show the program the way to that room (JOBCAT/STEPCAT) first. After VERIFY, the label is fixed and people can use the drawer again.
1. When should you run IDCAMS VERIFY?
2. You have a cluster in a user catalog with no alias. How do you run VERIFY?
3. What does VERIFY correct?