(
(
(
(
arith-arr-var arith-arr-var
READ char-var
,char-var
...
\
arith_var
l~l
arith-var
~
char-arr-var char-arr-var
str-func str-func
READ
The READ statement allows you
to
assign values
t.o
variables and array elements
from the internal data table created by DATA statements. The syntax
of
the
READ
statement
is
as shown:
\
arith_var
l~l
arith-var
~
arith-arr-var arith-arr-var
READ char-var
,char-var
...
char-arr-var . char-arr-var
str-func str-func
where:
var
are simple arithmetic or character variables, substrings,
or
subscripted references
to
a single array element. Only one variable
is
required.
When a READ statement
is
executed, successive values from
the
data table are assigned
to
the
variables
in
the
READ statement from left
to
right beginning
at
the
current
position of
the
data table pointer. The data table pointer can be returned
to
the
beginning
of
the table by the RESTORE statement.
Subscripts
of
array variables
in
the READ statement are evaluated as they occur;
thus, an assigned variable
in
a READ statement can be used subsequently as the sub-
script
of
another variable
in
the
same statement.
Notes About READ
• Each value read from the data table must be
of
the
same type (character
or
arith-
metic) as
the
variable
to
which it
is
assigned.
•
If
there are no DATA statements
in
the program, the READ statement causes an
error.
•
If
the data table
is
exhausted and unassigned variables still remain
in
the READ
statement, an error message
is
displayed.
• A READ statement
in
a program assigned
to
one
of
the
functi.on keys will cause
an error.
106