The FIND procedure positions a file at a specified component.
The file must be open for direct access and must contain
fixed-length components.
Syntax:
FIND( file_variable, component-number
[[, ERROR := error-recovery]] );
The 'file_variable' is the name of the file variable associated
with a file that is open for direct access.
The 'component-number' is a positive integer expression that
indicates the component at which the file is to be positioned.
If the component number is zero or negative, a run-time error
occurs.
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 FIND procedure allows direct access to the components of a
file. You can use the FIND procedure to move forward or
backward in a file.
After execution of the FIND procedure, the file is positioned at
the specified component. The file buffer variable assumes the
value of the component, and the file mode is set to inspection.
If the file has relative organization, the current file
component is locked. If there is no file component at the
selected position, the file buffer is undefined (UFB becomes
TRUE) and the mode becomes undefined. After any call to FIND,
the value of EOF is undefined.
You can use the FIND procedure only when reading a file that was
opened by the OPEN procedure. If the file is open because of a
default open (that is, with EXTEND, RESET, or REWRITE), a call
to FIND results in a run-time error because the default access
method is sequential.
See the "HP Pascal Language Reference Manual" for a complete
description of the FIND procedure.