The GET procedure advances the file position and reads the next
component of the file into the file buffer variable. If the
file has relative or indexed organization, the component is also
locked to prevent access by other processes.
Syntax:
GET( file_variable [[,ERROR := error-recovery]] );
The 'file_variable' is the name associated with the input file.
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.
Before the GET procedure is used for the first time to read one
or more file components, the file must be in inspection mode and
prepared for reading input. Depending on the access method
specified when the file was opened, you can prepare the file for
input in the following ways:
o If the file is open for sequential access, call the RESET
procedure. RESET sets the mode to inspection, advances the
file position to the first component, and assigns the
component's value to the file buffer variable.
o If the file is open for direct access, call either the RESET
or the FIND procedure to position the file.
o If the file is open for keyed access, call the FINDK, RESET,
or RESETK procedure to position the file.
As a result of the GET procedure, the file remains in inspection
mode, and the file position advances to the next component. If
a component is found other than the end-of-file marker, the
component is locked, EOF is set to FALSE, the file buffer
variable takes on the value of the component, and UFB is set to
FALSE. If a component is not found or the end of the file is
reached, EOF and UFB are set to TRUE. If the GET procedure
fails, UFB is set to TRUE and EOF becomes undefined.
See the "HP Pascal Language Reference Manual" for the complete
description of the GET procedure.