The preapply exit is taken for each before-image or after-image that is applied to a VSAM data set, before CICS® VR applies the change, for data sets that are being recovered in this CICS VR run.
For CICS VR backout, the exit is taken for every update, or for every add of a record that falls within the default or specified start and stop times. For forward recovery, it is taken for every update, if the original VSAM record has been successfully read, or for every add that falls within the default or specified start and stop times.
CICS VR passes the record that is read from the log and, where applicable, the VSAM record that is updated, to the exit program. The exit program can modify the log record. It can also tell CICS VR to ignore the log record and continue with the next record.
This exit gives you the opportunity to perform selective processing of records, depending on your special requirements. This type of processing is useful to help in logical recovery; that is, recovering from logical errors in the VSAM data set that are caused by an application, or by transactions that did not work correctly. The preapply exit lets you use CICS VR for this purpose.
If you try to perform logical recovery, there are situations that cannot be corrected by this exit. Although logical recovery might have recovered the data set to the state you require, other applications, online or offline, might have accessed the data set during the time it contained incorrect data.
You can do this to avoid updates that were made by an application or a transaction, or that were made during a specific time period.
You can check the content of the log record and the content of the VSAM record to be updated, and then modify the VSAM data and key fields in the log record in the way you require.