VMS Help
PASCAL, Input Output, Keyed Access
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Keyed access procedures are legal only on files opened for keyed
access.
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.
The RESETK procedure, like the RESET procedure, readies a file
for reading.
Syntax:
RESETK( file_variable, key-number[[, ERROR := error-recovery]] );
The 'file_variable' is the name of the file variable associated
with the input file.
The 'key-number' is a positive integer expression that indicates
the key position.
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.
The file can be in any mode before RESETK is called to set the
mode to inspection.
RESETK can be applied only to indexed files opened for random
access by key. You assign a key number from 0 to 254 to each
key field of a file component with the KEY attribute. The file
is searched for the component with the lowest value in the
specified key number. This component becomes the current
component in the file and is locked. The value of the current
component is copied into the file buffer; EOF and UFB are set to
FALSE. If the component does not exist, EOF and UFB become
TRUE.
Note that a RESETK procedure on key number 0 is equivalent to a
RESET procedure.
See the "Compaq Pascal Language Reference Manual" for complete
information on the RESETK procedure.
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.