
Use
the
GET
statement
to move
the
desired
record
into
the
random
buffer.
The
data
in the buffer
may
now
be acessed
by
the program.
Numeric
values
must
be
converted
back
to numbers
using
the
"convert"
functions:
CVI
for
integers,
CVS
for
single
precision
values,
and
CVD
for double
precision
values.
Program
B-5
accesses
the
random
file
"FILE"
that
was
created
in
Program
B-4.
By
inputting
the
three-digit
code
at the
termina~,
the
information
associated
with
that
code
is
read
from
~e
file
and displayed.
N$
CVS(A$)
10 OPEN
"R",t1,nFILE"
20 FIELD
'1,
20 AS
N$,
4 AS A$,
8 AS
P$
30 INPUT
"2-DIGIT
CODE";CODE%
40 GET
.1, CODE%
50 PRINT
N$
60 PRINT
USING
"$$t#t.#t";CVS(A$)
70 PRINT
P$:PRINT
80 GOTO
30
The
LOC
function,
with
random
files,
record
number."
The
current
record
last
record
number
that was
used
in a
For
example, the
statement
returns
the
"current
number
is one
plus
the
GET
or PUT
statement.
ends
program
execution
if
the
current
record
number
in
filet1
is higher
than
50.
Program
B-6
is an inventory
program
that
illustrates
random
file
access.
In this
program,
the
record
number
is used
as
the part
number,
and
it
is
assumed
the
inventory
will·
contain
no
more
than
100
different
part
numbers.
Lines
900-960
initialize
the data
file by writing
CHR$(255)
as the
first
character
of
each
record.
This
is used
later
(line
270
and
line
500)
to
determine
whether
an
entry
already
exists
for that
part
number.
Lines
130-220
display
the
different
inventory
functions
that
the program
performs.
When
you
type
in the desired
function
number,
line
230
branches
to the
appropriate
subroutine.
Содержание Basic Interpreter Basic 80
Страница 1: ...5IA iC intc tit tcl c t ...
Страница 2: ......
Страница 6: ... ...
Страница 10: ......
Страница 26: ......
Страница 33: ...2 5 Intentially left blank ...
Страница 37: ...BASIC SO COMMANDS AND STATEMENTS 2 9 Intentially left blank ...
Страница 40: ...410 DEF FNAB X Y XA3 YA2 420 T FNAB I J Line 410 de ines the function function is called in line 420 ...
Страница 112: ......
Страница 136: ......
Страница 140: ......
Страница 160: ......
Страница 165: ......
Страница 166: ......
Страница 174: ......
Страница 176: ......
Страница 182: ......
Страница 184: ......
Страница 190: ......