The READ procedure reads one or more file components into a
variable.
Syntax:
READ( [[file_variable,]] {variable-identifier
[[:radix-specifier]]},... [[, ERROR := error-recovery]] );
The 'file_variable' is the name associated with the input file.
If you omit the name of the file, the default is INPUT.
The 'variable-identifier' is the name of the variable into which
a file component will be read; multiple identifiers are
separated by commas.
The 'radix-specifier' is one of the format values BIN, OCT, or
HEX. These values, when used on a variable identifier, will
read the variable in binary, octal, or hexadecimal radix
respectively. You can use a radix specifier only when reading
from a TEXT file.
The 'error-recovery' is 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 must be in inspection mode before READ is called. The
file remains in inspection mode after execution of a READ
procedure.
By definition, the READ procedure for a nontext file performs an
assignment statement, a GET procedure, and an UNLOCK procedure
for each variable.
The READ procedure reads from the file until it has found a
value for each variable in the list. The first value read is
assigned to the first variable in the list, the second value
read is assigned to the second variable, and so on. The values
and the variables must be of assignment-compatible types.
Reading stops if an error occurs.
For a TEXT file, more than one component (character) can be read
into a single variable. For example, many characters can be
read into a string or converted into a numeric variable. The
READ procedure repeats the assignment, GET, and UNLOCK process
until it has read a sequence of characters that represent a
legal value for the next variable in the parameter list. The
procedure continues to read components from the file until it
has assigned a value to each variable in the list.
See the "HP Pascal Language Reference Manual" for a complete
description of the READ procedure.