Intel 9800758-02 Webcam User Manual


 
BASIC-SO
Disk File Input/Output
The FIELD statement can precede
or
follow the GET statement, but
N$
doesn't
contain those first
20
bytes until the FIELD statement. (A similar definition
of
fields
must be done when writing to a random file with the
PUT
statement; the FIELD
statement, obviously, must precede the
PUT
statement so that BASIC-80 will know
which variable
or
variables to write to the disk.)
Any number
of
fields
can
be defined with one FIELD statement. In the preceding
example, for example, let's assume
that
character positions 21-29 (the 9 bytes
following the name field) contain a social security number. To define the first
20
bytes as N$ and the next 9 bytes as SS$, enter the following FIELD statement:
FIELD
#3,
20
AS
N$,
9
AS
SS$
Not
only
can
you define all
128
bytes this way, you can enter more than one FIELD
statement for the same buffer.
If
more
than
one FIELD statement associates a string
variable with character positions in the buffer, the last-executed one applies.
If
several FIELD statements are executed
that
specify different string variables,
however, all the field definitions are effective.
Figure
5-1
summarizes this relationship
of
disk record,
110
buffer, and string
variables,
and
shows the sequence
of
BASIC-80 statements necessary to read a
record, assign the first
20
bytes to N$,
and
the next 9 bytes to
SS$
(the remaining
99
bytes are ASCII blanks). The program shown opens the file, reads the field record,
and prints both N$ and
SS$.
10
OPEN
"R",
3,
"F1:PERSON"
20
GET'3,
1
30 FIELD
1#3.1
20
AS
N$, 9
AS
55$
40 PRINT
N~,
55$
RUN
JONES, JOHN J. 517317010
OK
RECORD
1 OF
:F1:PERSON
GET
STATEMENT
TRANSFERS CONTENTS
OFRECORDTO
1/0
BUFFER
1/0
BUFFER FOR
FILE
"rMBER
3
IJ,o,N,E,s,,J
IJIOIHINI
IJI·I
11511171311171011101 I I I I I
Iltl
I I
DEFINI~~~~
"""1·1f-------N$------·
...
I..--ss$------~BLANKS---+-1
(20
BYTES)
(9
BYTES)
(REMAIN ING
99
BYTES)
Figure
5-1.
Random
I/O
Characteristics
5-5