Enhanced KEY Function

The The KEY function has been enhanced for those files/tables that support multi-segment alternate keys such as standard PVX keyed files, EFF files, Databases, and Memory tables. The new KEY function allows the user to get the internal generated key value for a file when specifying a KEY= option in the function.

Internally, ProvideX generates a simple string consisting of the various field values used to reference the file. When accessing a file by a multi-segmented key, the programmer can specify each of the segment values to be provided in the KEY= clause of the I/O operation with each key segment separated by a colon. For example READ (1, KEY=A$:B$:C$) tells the system to use A$ as the value for the first field segment of the key, B$ for the second, and C$ the third.

In addition, the KEY function has been enhanced to allow you to specify a KEY= clause. In this case, the KEY function will return the generated key based on the segments you have provided.

For example, a multi-segment key with the following segments: the first is 10-characters long, the second is 5-characters long, and the third is 5-characters long. A KEY(fileno, KEY=A$:B$:C$) will return a string comprised of the individual key elements, each $00$ padded to the corresponding lengths of the multi-segment key. Therefore, A$ would be a length of 10, B$ would be a length of five, etc.

The KNO= clause can be specified in order select the specific key you want generated.

A typical example might be to set the BEGIN or END values in a SELECT directive as in:

SELECT ... FROM <file> BEGIN KEY(<file>, KEY=S1$:S2$:S3$)
...
NEXT RECORD

A KEY function that specifies a KEY= clause does not affect the current status or position of the file.