The REPAIR utility repairs or fixes data in tables and their related data structures. The data can be of any type, such as data contained in a table or data that is generally not accessed, such as map pages and index entries.
The options of the REPAIR utility are:
REPAIR DBD: Tests Database Descriptors (DBDs) that point to corresponding data items in the DB2 catalog database.
REPAIR SET: Resets pending flags that are no longer necessary.
REPAIR LOCATE: Changes the data at specified locations of a dataset. The result of a REPAIR utility usually contains the altered page or pages in the specified DB2 table or index and a dump of the contents.
The REPAIR utility with the Log YES option can be used to ensure that all changes made are logged and recovered. The REPAIR utility should be carefully used because it substitutes the existing data with new data.
JCL sysin card for REPAIR utility.
//SYSIN DD *
LOCATE TABLESPACE DSN9D41A.DSN9S41D PAGE X’05’
VERIFY OFFSET 50 DATA X’A00′
REPLACE OFFSET 50 DATA X’D11′
DUMP OFFSET 50 LENGTH 4
The above REPAIR statement alters the data on the fifth page at offset 50 from its initial value X‘A00’ to X‘D11’. The utility statement first checks whether or not the location matches the value X’A00’ and then modifies the data by replacing it with the new data specified. The four characters are dumped to ensure that the changes made are correct.