VSAM VERIFY

The VSAM VERIFY command is used to verify, and if necessary, update, the end of file information in the VSAM catalog in order to make the catalog information consistent with the data file. The command adds correct End-Of-Data records to the file. This command cannot be used for an empty VSAM file where the high-used RBA (Relative Byte Address) in its catalog record is 0 (zero).

The creation of a low-value record in an empty VSAM file is normally the first step VSAM performs after a file is defined. When a VSAM dataset is closed in an update program, VSAM will update the end of file information in both the VSAM catalog and the data file. If an update program fails or the operating system fails, VSAM may not close the file properly. When this happens, VSAM is unable to update important information in the file’s catalog record. Also, it is flagged to indicate that the dataset may be corrupt

The VSAM file’s catalog record has the high used RBA that specifies the end of the file address. If this field is not updated, the information stored in the catalog record does not agree with the actual contents of the related file. After the abnormal termination of a VSAM file, the VERIFY command must be executed to correct the catalog record information to reflect the actual status of the dataset before the file is used again

VSAM VERIFY SYNTAX

VERIFY {FILE(ddname[/password]) |
DATASET(vsam-file-name[/password])}

The input dataset can be specified using FILE (DD name with a DD statement to identify the dataset), or DATASET (The name to identify the dataset in the catalog).

There is no CATALOG option for the VERIFY command, so if there is no alias defined for the catalog in which the dataset can be located, it will be necessary to use either a JOBCAT or STEPCAT DD statement for the proper catalog.

The RECOVER parameter can be specified to fix errors.

The following example shows how to check and fix errors in the VSAM dataset.

//VSAMVRFY JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL VERIFY AND FIX ERROR IN VSAM DATASET
//*************************************************************
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN DD  *
   VERIFY DATASET(XXXXXX.YYYYYY.VSAMFILE)
   VERIFY DATASET(XXXXXX.YYYYYY.VSAMFL01)
   VERIFY DATASET(XXXXXX.YYYYYY.VSAMFL02)
   VERIFY DATASET(XXXXXX.YYYYYY.VSAMFL03)
/*

The following example shows how to check and fix errors with RECOVER in the VSAM dataset.

//VSAMVRFY JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL VERIFY AND FIX ERROR IN VSAM DATASET
//*************************************************************
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN DD  *
   VERIFY DATASET(XXXXXX.YYYYYY.VSAMFILE) RECOVER
/*

Verify will verify the cluster and alternate index but the verification of the base cluster does not verify its alternate indexes.

//VSAMVRFY JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL CHECK AND FIX ERROR IN VSAM DATASET
//*************************************************************
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN DD  *
    LISTCAT   ENTRIES(XXXXXX.YYYYYY.VSAMFILE) -
              ALL
    VERIFY    DATASET(XXXXXX.YYYYYY.VSAMFILE)
    LISTCAT   ENTRIES(XXXXXX.YYYYYY.VSAMFILE) -
              ALL
/*

VSAM EXAMINE

Examine command is used to check the structural integrity of a key-sequenced data set cluster. It checks for index and data components and if any problem is found, the error messages are sent spool. You can check any of the IDCxxxxx messages.

MINE NAME(vsam-ksds-name) -  
     INDEXTEST DATATEST -        
     ERRORLIMIT(50)

In the above syntax, vsam-ksds-name is the VSAM dataset name for which we need to examine the index and data part of the VSAM cluster.

INDEXTEST – It checks the index component of the key-sequenced data set cluster by cross-checking vertical and horizontal pointers contained within the index control intervals, and by performing analysis of the index information. It is the default test of EXAMINE.

DATATEST – It checks the data component of the key-sequenced data set cluster by sequentially reading all data control intervals, including free space control intervals. Tests are then carried out to ensure record and control interval integrity, free space conditions spanned record update capacity, and the integrity of internal VSAM pointers contained within the control interval.

The following example shows how to check whether the Index and Data part of the KSDS dataset is synchronized or not.

//KSDSPRNT JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL EXAMINE KSDS INDEX AND DATA ARE IN SYNC
//*************************************************************
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
   EXAMINE NAME(XXXXXX.YYYYYY.KSDSFILE) -
   INDEXTEST DATATEST -
   ERRORLIMIT(50)
/*

VSAM Tutorials

VSAM Define Cluster: Click Here IBM Reference: Click Here

Scroll to Top