Complete Interrupted VSAM Processing
Issuing the EXAMINE command for a data set that was closed improperly, as a result of a CANCEL, ABEND or system error, can result in a condition code of 8 because of an interrupted VSAM process. You can complete or back out the interrupted VSAM process by adding the RECOVER parameter to the VERIFY command. Then, to check for any remaining errors, use the EXAMINE command for the data set again. This is illustrated in the following example.
//REPRO JOB ...
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
EXAMINE NAME(TARIN) INDEXTEST DATATEST
IF LASTCC > 4
THEN DO
VERIFY DATASET(TARIN) RECOVER
EXAMINE NAME(TARIN) INDEXTEST DATATEST
END
IF LASTCC > 4
THEN DO
SET MAXCC = 12
CANCEL
END
REPRO INDATASET(TARIN) OUTDATASET(TAROUT)
/*
The first EXAMINE command checks the index and data structures of the source key-sequenced data set, TARIN. INDEXTEST instructs EXAMINE to check the index structures. DATATEST instructs EXAMINE to check the data structures.
If the first EXAMINE command completes with a condition code greater than 4, the VERIFY command is processed. The RECOVER parameter instructs VSAM to complete or back out interrupted VSAM processing.
The second EXAMINE command checks for any errors that remain after the VERIFY command.
The SET MAXCC and CANCEL commands terminate the job step with condition code 12 if EXAMINE still detects errors. This prevents the processing of the subsequent REPRO command for a problem data set.
The REPRO command copies all records from the source data set, TARIN, to the target data set, TAROUT.