29
ADD INDEX Directive
Add Key to Keyed File
Format
ADD INDEX keydescription TO filename$ [,ERR=stmtref]
Where:
filename$
Name of the file to which the key will be added. String
expression.
keydescription$ Description of the key using the same format as KEYED directive.
stmtref
Program line number or label to transfer control to.
TO
Mandatory keyword, not case-sensitive.
Description
The ADD INDEX directive allows keys to be added to a ProvideX Keyed file without
having to rebuild the file. When adding keys to the file:
· ProvideX builds keys on-the-fly.
· Exclusive access to the file is required.
· Keys are assigned the next available key number.
· When adding a unique alternate key, the add generates an error and the key is not
defined if duplicate keys are in the desired index.
· Only one key can be added at any one time (ADD or DROP cannot execute at the
same time and will fail with an error zero).
· The key names are case insensitive (key will be converted to uppercase characters).
· The first character of the key name cannot be a "#" as this is reserved for access to
the keys by key number.
· If a key name is specified, it cannot be null; e.g., "".
· Spaces are valid and significant. A name of " " (space) is valid, and is not the same
as a key of " " (space space).
Note: A total key length that exceeds 240 characters will result in Error #80:
Invalid key definition.
Example
ADD INDEX ["KeyName":2:1:30]+[1:1:6] TO "cstfile"
See also