VMS Help PASCAL, Input Output, Keyed Access, FINDK *Conan The Librarian (sorry for the slow response - running on an old VAX) |
The FINDK procedure searches the index of an indexed file opened for keyed access and locates a specific component. Syntax: FINDK( file_variable, key-number, key-value[[, match-type]] [[, ERROR := error-recovery]] ); The 'file_variable' is the name of the file variable associated with the file to be searched. The 'key-number' is a positive integer expression that indicates the key position. The 'key-value' is an expression that indicates the key to be found. It must be assignment compatible with the key field in the specified key position. The 'match-type' is an identifier that indicates the relationship between the key value in the FINDK procedure call and key value of a component. The 'error-recovery' specifies the action to be taken if an error occurs during execution of the routine. By default, after the first error, the error message is printed and execution is stopped. When you establish key fields with the KEY attribute, you assign each one a key number from 0 to 254. Key number 0 represents the mandatory primary key of the file. Separate indexes are built for each key number in the file. The key value and the match type provide information about the key to be found. The key value must be assignment compatible with the key fields of the key number being searched. The match type must be EQL (equal to the key value), NXT (the next key in the collating sequence after the key value), or NXTEQL (the next or equal key in the collating sequence after the key value). If the FINDK procedure was used on an ascending collating sequence, NXT and NXTEQL would be equivalent to GTR and GEQ. If a descending collating sequence was used, it would be the same as LSS and LEQ. The match type is optional; if omitted, it defaults to EQL. The FINDK procedure can be called for any indexed file opened for keyed access, regardless of the file's mode. If the component described exists, the file buffer is filled with that component; UFB and EOF both become FALSE. The mode is set to inspection and the component is automatically locked. If no component is found to match the description, UFB becomes TRUE and EOF is undefined. The mode is set to undefined. See the "Compaq Pascal Language Reference Manual" for complete information on the FINDK procedure.
|