Testing File Integrity

The -check option of vutil tests a file for internal consistency. The command is:

vutil  -check  [ -afkqx ]  [ files ]

With no options, vutil reads a list of files from the standard input and tests each one for a non-zero user count and other quickly tested errors. Files with errors or a non-zero user count are listed. You may place the list of files to check on the command line instead of using the standard input.

-a       (for automatic) This option causes vutil to do a thorough test of each file that has a non-zero user count. It will read every record in an attempt to see if the file is broken. Any problems that are detected are printed. You can use this option to test a large number of files for errors without exhaustively reading every record from every file. Only those files that appear to have potential problems (because of the non-zero user count) are tested.
-f (full) This option forces a file to be checked (including files with a user count of zero). When both -a and -f are specified, -f takes precedence.
-k (key number) This option is used to specify the key to be used to read the file. All the keys in the file are read sequentially by the specified key during the check of the file. This option must be used in combination with the -a or -f option. This option has no effect when used with the -x option. -k must be followed (as the next separate argument) by the number of the key you want to use. Zero (0) indicates the primary key, 1 indicates the first alternate, and so forth.
-q This option causes vutil to exit (with status 99) if user interaction is required.
-x (extended tests) This option causes vutil to run extended tests in place of those that are normally run by the -a or -f options. The extended tests include: reading every record with every key, reading the records in their physical order in the file, and checking the deleted records list. The filename is displayed along with a message that indicates which test vutil is currently working on. This option causes a write lock to be placed on the file to ensure exclusive access during the tests. You must specify the -x option with either -a or -f on the same command line; used by itself, it does nothing. The -x option disables the -k option when the two are specified on the same command line.
Note: Although the -check option tests the file thoroughly, it is possible for a file to be corrupt and still pass the test. If you're processing an indexed file outside of vutil and you receive a file error 98, that file is corrupt even if it passed the vutil -check test.

For convenience in building scripts, the -check option will not complain if given a non-Vision file. This allows -check to be run on an entire directory without generating spurious errors from relative and sequential files.

When you perform vutil -check, one of the following status values is returned to the host operating system when vutil quits:

0 file passed all checks
1 checks not fully performed because the file was in use
2 non-zero user count found
3 file is corrupt
99 user interaction was required, and the -q switch was set
255 vutil fatal error or incorrect command line

If more than one file is checked, the highest status value that applies is returned.