INPUT
INPUT
#file-numberl.REC numeric-express'ionll:variable-hstl
(See also the "Input-Output
Statements"
section.)
Thi:s
form
of
the
INPUT
statement
allows
you
to
r~ad
data
from
an
accessory device
The
INPUT
statement
can
be
used only with files
opened
in
INPUT
or
UPDATE
mode,
The
file-number in the
INPUT
statement
must
be
the
fde'number
of
a
currently
open
file.
File-number
O.
the keyboard, may always
be
used
If
you choose to
use Me-number
O.
the
INPUT
statement
is performed
as
described
in
"Input·Output
Statements."
except
that
you
cannot
specify
an
input-prompt.
The
variable-list contains those variables which
are
assigned values
when
the
INPUT
statement
is performed. Variable
names
in
the
variable·list
are
separated
by
commas
and
may
be numeric
and/or
string
variables.
Filling the variable-list
When
the
computer
reads
records from a file. it
stores
eaeh
complete record internally in a
temporary
stora~e
area
called
an
input/output
(liD) buffer. A
separate
buffer
is
provided
for
each
open file-number, Values
are
assi~ned
to variables
in
the variable-
list
from left to right. using the
data
in this buffer. Whenever a
variable-list
has
been
filled with
corresponding
values. any
data
items left in the buffer
are
discarded
unless
the
INPUT
statement
ends with a trailing comma. Using a trailing
comma
creates
a
"pending"
input
condition (see "Using
Pending
Inputs").
If
the
variable-list in the
INPUT
statement
is longer
than
the
number
of
data
items in the
current
record being processed. the
computer
will get the next record from the file and use its
data
items
to
complete
the variable-list, as shown on the right.
When
performing
the
INPUT
statement.
the
computer
will
take
different actions
dependmg
on
whether
the
data
stored
is
ill
DISPLAY
or
INTERNAL
format.
User's Reference Guide
Examples:
>NEII
>100
OPEN
1113:"CS1",SEQUENTIA
L,DISPLAY,INPUT,FI~ED
>110
INPUT
1113:A,B,C$,D$,X,Y,
Z$
>120 IF A=99
THEN
150
>130 PRINT
A;B:C$:D$:X;Y:Z$
>140
GOTO
110
>150
CLOSE
1113
>160
END
>RUN
--data
stored
on
tape
will
be
printed
on
the
screen
**
DONE
**
>NEW
>100
OPEN
#13:"CS1",SEQUENTIA
L,~TSPLAY,lNPUT,FIXED
64
>110
INPUT
1113:A,B,C,D
•
program
Lines
>290
CLOSE
1113
>300
END
>RU
N
--1st
INPUT
RECORD=22,77,56,
92
--Results:
A=22 B=77 C=56
D=92
>NEW
>100
OPEN
#13:"cS1",SEQUENTlA
L,DISPLAY,INPUT,FIXED 64
>110
INPUT
#13:A,B,~,D,E,F,G
.
program
lines
>400
END
--1ST
INPUT
RECORD=22,33.5
--2ND
INPUT
RECORD=405,92
--~RD
INPUT
RECORD=-22,11023
--4TH
INPUT
RECORD=99,100
--ResuLts:
A=22
8=33.5
C=405
D=92
E=-22
F=11023 G=99
n-l2S