Recovering a Corrupted File (File Status 98)



To recover a corrupted file which is returning a file status 98, use the "rebuild" option of the Acucobol utility, vutil. Keep in mind that the Vision file system has redundancies built into it, so that different rebuild options (-k #) will use different algorithms to rebuild the file. If one fails, another may succeed.

At the end of a rebuild operation, you will be prompted with "Do you wish to replace the original file?" If you respond N (NO), you will retain the rebuilt file, such as it is, in the current working directory. It will be named VTMP####.

  • vutil -rebuild filename
  • vutil -rebuild -k 0 filename (rebuild on primary key)
  • vutil -rebuild -k 1 filename (rebuild on 1st alternate key)
  • vutil -rebuild -k 2 filename (rebuild on 2nd alternate key)
    ( ..... vutil -rebuild -k n filename rebuilds on nth alternate)

If you have compressed files, and none of the above options recover the entire file, try the same commands again but add the -c argument. This will undertake a rebuild while removing compression from the file. This will rebuild the file in a different binary configuration, which may resolve the problem.

If none of the above successfully rebuilds the file, then you are faced with recovering as much data as possible. One possible strategy is to merge the most recent backup with all the VTMP#### files which you have accumulated by using the above rebuild commands.

Another option is to write a COBOL version of rebuild, which you can easily construct yourself.

This program would have the form:

  Open input Original-File
  Open output Master-File
  Start Original-File at Low Values
  Read Original-File Next Record
 * Set Declaratives so that error 98's are trapped , and
 * the response is to increment the current key by 1 in the 
 * least significant digit, and the start is re-tried.
 * Code your Start with an Invalid Key phrase which does
 * the same thing.
  Write Master-File.

You will need to set the configuration option, "ERRORS-OK" to 1 in order to open a corrupted file for I-O.

Sometimes the header of file gets corrupted, and vutil no longer is able to recognize it as a Vision file ("filename: Incorrect file type" on any vutil command). Since the pointer to the first record in a Vision file is always the same, you can try replacing the first 512 bytes (the header) of a Vision file with the first 512 bytes of a Vision file created via open output with the same SELECT and FD as the broken file. Then use vutil -rebuild to rebuild the patched, broken file.

Your Session will expire in 90 minutes
Notification will be shown in:
600 seconds