Directives
ADD INDEX |
Add Key to Keyed File |
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 statement. |
stmtref |
Program line number or statement label to which to transfer control. |
TO |
Mandatory keyword, not case-sensitive. |
The ADD INDEX directive allows keys to be added to a PxPlus Keyed file without having to rebuild the file. When adding keys to the file:
- PxPlus 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.
DROP INDEX Drop Key from Keyed File
RENAME..INDEX Rename Keys in Keyed File
add index ["KeyName":2:1:30]+[1:1:6] to "cstfile"