DATA
{arith~on}r{arith~on}
J
...
char~on
L'
char~on
62
DATA
The
DATA
statement
is
a nonexecutable statement
that
causes an internal data table
to
be
created. The data table constants are supplied
to
variables and array elements
specified
in
corresponding READ or
MAT
READ statements.
The syntax
of
the DATA statement
is
as
shown:
DA
TA
{arith~on}[{arith~on}
J
...
char~on
'
char~on
where:
con
is
an arithmetic or character constant. Only one constant
is
required.
At the beginning
of
program execution (before any executable statements are
executed), a table containing
all
the constants from
all
the DATA statements (in
their order of appearance by statement number)
is
built. At the same time, a
pointer
is
set
to
the first constant
in
the table. The pointer
is
advanced through the
table, constant by constant,
as
the data
is
supplied
to
READ or
MAT
READ state-
ment variables. (The pointer can
be
changed
to
point
to
the first constant again by
the RESTORE statement.)
DATA statement character constants containing
less
than 18 characters are padded
on the right with blanks
to
a length
of
18 before being assigned
to
character vari-
ables. Character constants containing more than 18 characters are truncated on the
right
to
a length of 18 before being assigned
to
character variables.
Notes About DATA
• Each constant
in
a DATA statement must be
of
the
same type
as
that
specified
for the variable
to
which the constant
is
to
be assigned
in
the corresponding
READ
statement. Thus,
if
the third constant
in
a DATA statement
is
a character
constant, then the READ statement variable
to
which it
is
assigned must also
be
a character variable.
• DATA statements can
be
placed anywhere
in
a program, either before or after
the READ statement
to
which they supply data.
•
An
error
will
occur
if
DATA statements do not contain enough constants for
the READ statements issued.
•
DATA
statements cannot be used
in
a program assigned
to
one
of
the
function
keys.
"
...