Chapter
10
I
BASIC
Keywords
FIELD
Statement
FIELD
buffer, length
AS
variable[,length
AS
variable,
...I
Divides a direct access buffer into fields
so
that you can send
data from memory to disk and disk to memory. Each field is
identified by
variable
and
is
the
length
you specify.
Buffer
is the number assigned to the file when you opened it.
Variable
must be
a
string variable.
Length
is an integer in the range
1
to
255
representing the
length of that field. The sum of all field lengths are equal
to
the
record length assigned when you opened the file.
An
OPEN
statement assigning the buffer number must precede
the FIELD statement. FIELD must precede GET and PUT.
You may use the FIELD statement any number of times to re-
field a file buffer. Fielding a buffer does not clear the buffer’s con-
tents; it only alters the way the buffer is accessed. You may ac-
cess the same disk file any number of ways simply by re-fielding
it.
Note:
All data-both strings and numbers-must be
placed into the buffer in string form. There are three
pairs of functions (MKI$/CVI, MKS$ICVS, and
MKD$/CVD) for converting numbers
to
strings and
strings to numbers.
See also Chapter
7,
“Disk Files,” OPEN, CLOSE, PUT, GET,
LSET, and RSET.
159