![]() |
![]() |
KSAM/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Appendix E RECOVERY FROM SYSTEM FAILURE ![]() SITUATIONS IN WHICH RECOVERY IS REQUIRED |
|
Whenever the file cannot be reopened (error #192 is issued), you must run KEYINFO to recover the file. The following four cases are typical of the reasons for file damage. In each case, the suggested action is discussed.
If you want to determine how many key values are missing and the file has more than one key, you can compare the number of values in each B-Tree as listed by KEYINFO. These values should be identical. When there is only one key in the file, you can use FCOPY to determine the number of non-deleted records in the batch file. The number of key values for any key in the file should exactly match the number of valid data records. The FCOPY command to determine this value is:
If your file is very large, using this FCOPY command can be time consuming and you may prefer to reload the file without checking the number of missing keys. Suppose you try to open file TEST and receive error message #192:
In order to have the most information about the file, first run KSAMUTIL and request VERIFY to list all the file information.
Just like any other program, the VERIFY command cannot open the damaged file. So try again using the NOCHECK option that allows such a file to be opened for read-only: ![]() The next step is to run LISTF,2 to see where the MPE end-of-file is positioned. Note that you can request the MPE command without exiting from KSAMUTIL.
LISTF shows the MPE end-of-file after the first 900 records, whereas option 1 of VERIFY showed the KSAM end-of-file after 990 data records. This is a discrepancy of 90 records. These records actually exist. You only have to run KEYINFO to reset the MPE end-of-file. When you run KEYINFO, however, you may find that there are other problems.
After resetting the MPE end-of-file for the data file, KEYINFO continues. It next displays information on the two keys in the file TESTK.
Looking at the key information displayed for the two keys, the first thing to check is where the actual end of file should be. The largest key block address for key 1 is 210 and each block requires 8 records, therefore the key file end-of-file should be at least 218. If you look back to option 3 of the VERIFY display, it is listed as 210. Since this is not the real end-of-file, KEYINFO resets the KSAM internal end-of-file to the actual end of file (see VERIFY display, below). Next, check the total number of key values for each key. The first thing to notice is that they do not match each other. The number of key values for each key should always be the same, and each should equal the number of records in the data file. But, if you look at option 1 of the VERIFY display, the number of records in the data file is 990, less than the number of key values for either key. (Note that if the file contains records marked for deletion, you can run FCOPY to determine the number of active records). In response to this discrepancy, KEYINFO deletes 10 key values from each key. The values deleted are those that have no matching data record. This completes the KEYINFO functions. Now that it has deleted 10 key values from the key entries for key 2, only 987 are left (997 minus 10). This is three fewer than the number of key values in key 1 (990 = 1000 -10). For this reason, KEYINFO must issue the warning that the file needs to be reloaded:
Before reloading the file, as described below, use LISTF,2 to check the current MPE end-of-file (after recovery); run VERIFY to check the current KSAM end-of-file positions; and run KEYINFO again to see the number of key values left in each key following the previous KEYINFO recovery. ![]() The name of the user who runs KEYINFO to recover the file for the RESET DATE shown by VERIFY is stored in the key file control block, along with his account, group, and home group (refer to Figure B-5 “Control Block and Key Descriptor Block”). |