Directives 

ADD INDEX

Add Key to Keyed File

Format

ADD INDEX keydescriptionTO filespec [,ERR=stmtref]

Where:

filespec

Can be a numeric expression indicating the open channel number to use or a string expression containing the pathname of the file to which the key will be added. If using the file channel, it must be to a keyed or memory file, and if it is a keyed file, the channel must be locked.

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.

(Support for using a file channel was added in PxPlus 2023 Update 1.)

Description

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:

Note:
A total key length that exceeds 240 characters will result in Error #80: Invalid key definition.

See Also

DROP INDEX Drop Key from Keyed File
RENAME..INDEX Rename Keys in Keyed File 

Example

add index ["KeyName":2:1:30]+[1:1:6] to "cstfile"