Kore Tech Tip
How to Fix Data Corruption in U2 Files

Another way to fix a corrupted UniData/UniVerse file

The standard way to fix UniVerse files is to run the UVFIXFILE command. However, the other day I ran into a problem with a Type 2 file on an NT/Universe system where a basic program when writing specific records would abort and disconnect the user from the system. Since this was the Universe DBMS we ran UVFIXFILE to see what that discovered and there was no reported problem with the file. It is documented that UVFIXFILE will not find every file problem -- apparently this was one of those situations.

The process that was causing the problems wrote records to a file with ID’s like 123*1 123*2 123*3… After much research, we found that the process would abort when a record whose item-ID ended with *10 was being written. This was very odd as records 123*1 to 123*9 were written without a problem. We tested writing a record with the *10 ID and got disconnected.

Now what do you do? You use a solution that is as old as the PICK Operating System! We created a temporary file and counted the number of records in the corrupted file:


85637 records counted.
We next copied the records from the corrupted file to the temporary file:

85637 records copied.
Fortunately, it copied the same number of records. Next, we cleared the original file, and then copied our data back:
 File "FILE1" has been cleared.

 85637 records copied.
Next we tested the file by trying to write a record with exactly the same ID as one that failed – It worked:
>ED FILE1 123*10
 New record.

Last, we got rid of the temporary-file:
Now, there was lots of data to fix – lots of orphaned records and summarized data that was overstated, but at least the system would allow us to work on that file!

Note - These commands will work on UniData with the same syntax except that you may not wish to use an “I” option with the COPY command as the “I” option will list all items being copied while on Universe it suppresses that list.

UniData and UniVerse are products, copyrights and trademarks of Rocket Software
Our technical tips are provided to help you find new or easier ways to solve some of your technical challenges or to show you a new technique. We hope you find them useful. Please contact us if you would like to share one of your Tech Tips or need help solving a technical challenge. We would be happy to help you.