KGEN() Function - Key Generate
Syntax
KGEN(str1,str2,int{,ERR=lineref})
Description
The KGEN() function derives the value of a key contained within a record.
Parameter |
Description |
---|---|
str1 |
Record containing a key. This record may have been read in from an MKEYED, XKEYED or VKEYED file or built in an application program. |
str2 |
Description of the key segments for the record contained in str1. Normally, this string is obtained from bytes (86) to the end of the FIN() of an MKEYED, XKEYED or VKEYED file. |
int |
Key number. |
ERR=lineref |
Branch to be taken if an error occurs during execution. |
By default, the KGEN() function returns string values that can be directly compared across records to produce the correct sorting sequence. If the key definition contains field modifications ("B", "D", "I", "N", "U"), this raw string might not correspond to the value returned by the KEY() function. To generate a value that corresponds to the KEY() function, add 256 to the desired key number.
NOTE: If str1 does not contain enough data, or the format of the data is not as the combination of str2 and int describes, an error will be generated. Additional errors may be generated if str2 is not formed correctly or int is not a key in str2.
Examples
|