171
KEYED LOAD Directive
Load and Repair Keyed File
Format
KEYED LOAD (chan,[KNO=num | name$])
Where:
chan
Channel or logical file number of the file to be read/repaired.
num
Key number (0-15 for VLR/FLR files, 0-255 for EFF files).
name$
Name of the key (if assigned). String expression.
Description
This directive is used to rebuild the key tables of a file which is currently open on a
channel. KEYED LOAD (chan) rebuilds all key trees. To rebuild a specific key chain,
use the file access key value KNO=num | name$. KEYED LOAD will identify
duplicate primary or unique keys.
The file does not have to be locked for KEYED LOAD to work. KEYED LOAD rebuilds
the key chains within the file without using more disk space, while the file is in use,
and while the file is being updated by others. KEYED LOAD is much faster than *UFAR
in repairing key trees.
However, it performs much faster if the file is locked, and if there is sufficient ram
available for its key block buffering operations. Also, KEYED LOAD will update the
number of records for fixed length files if the file is locked.
Once the KEYED LOAD command is completed, TCB(67) will be set to one of the
following values:
> 0 represents the number of keys reloaded.
-1
indicates that a different number of keys were encountered on different key
chains. This may or may not indicate that the file being re-loaded has physical
damage that KEYED LOAD is unable to correct; i.e., the file can be reloaded on
the fly while others are adding records, and therefore the number of keys on a
given key chain may have changed while KEYED LOAD was working.
Note: KEYED LOAD reports invalid file type when used on Sort files. KEYED LOAD
will not operate on files opened in Read-Only mode.
Example
->open (1)"datafile.dat"
->keyed load (1)
Done - loaded key number
0
with
263
keys
Done - loaded key number
1
with
263
keys
Done - loaded key number
2
with
263
keys
Done - loaded key number
3
with
263
keys
Done - loaded key number
4
with
263
keys
Done - loaded key number
5
with
263
keys