Radio Shack TRS-80 Trsdos & Disk Basic Reference Manual page 133

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

DISK BASIC
Random
Access Statements
FIELD
(organize a
random
file-buffer into fields)
FIELD
nmexp,nmexpl
AS
varl$
[,nmexp2
AS
var2$
.
.
.]
where
nmexp
specifies a
random
access
file
buffer,
nmexp=\,2,
...
,15
nmexpl
specifies
the length
of
the
first
field,
varl$
defines
a
variable
name
for
the
first
field
nmexp2
specifies
the length
of
the
second
field
var2$
defines
a
variable
name
for
the
second
field
subsequent
nmexp
AS
var$
pairs
define
other
fields
in
the buffer
Before
FIELDing
a buffer,
you must
use
an
OPEN
statement
to
assign that
buffer to
a
particular disk
file
(must
use
random
access
mode).
Then
use the
FIELD
statement
to
organize
a
random
file
buffer
so that
you
can
pass
data
from
BASIC
to disk storage
and
vice-versa.
Each random
file
buffer has
255
bytes
which
can
store
data
for
transfer
from
disk storage to
BASIC
or
from
BASIC
to
disk.
However,
you
need
a
way
to access
this
buffer
from
BASIC
so
that
you
can
either
read the data
it
contains or place
new
data
in
it.
The
FIELD
statement provides
the
means
of
access.
You may
use the
FIELD
statement
any
number
of times
to
"re-organize"
a
file
buffer.
FIELDing
a
buffer
does not
clear
the
contents of the
buffer;
only the
means
of
accessing the buffer
(the
field
names)
are
changed. Furthermore,
two
or
more
field
names
can
reference the
same
area
of
the
buffer.
Examples:
FIELD
1,
255 AS R$
This statement
tells
BASIC
to
assign
the
entire
255-byte
buffer
to
the
string
variable
A$.
If
you
now
print
A$,
you
will
see
the contents
of the
buffer.
Of
course,
this
value
would be
meaningless
unless
you
have used
GET
to
read
a
255-byte
record
from
disk.
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$/CVS,MKD$/CVD)
for
converting
numbers
to
strings
and
vice-versa.
See "Functions", below.
7-47

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents