EasyManua.ls Logo

Commodore 1581 - Expanding a Relative File; Writing Relative File Data; Designing Relative Records

Commodore 1581
138 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
different
from
the
equivalent
line
in
the
error
check
subroutine
given
earlier.
Here
disk
error
number
50
is
specifically
ignored,
because
it
will
be
generated
when
the
error
channel
is
checked
in
line
1460.
Ig
nore
it
because
not
having
a
requested
record
would
only
be
an
error
if
that
record
had
been
created
previously.
EXPANDING
A
RELATIVE
FILE
If
you
underestimate
your
needs
and
want
to
expand
a
relative
file
later,
simply
request
the
record
number
you
need,
even
if
it
doesn't
currently
exist
in
the
file.
If
there
is
no
such
record
yet,
DOS
will
create
it
as
soon
as
you
try
to
write
information
in
it,
and
also
automatically
create
any
other
missing
records
below
it
in
number.
When
the
first
record
beyond
the
current
end
record
is
written,
the
DOS
returns
"50,
RECORD
NOT
PRESENT"
error.
This
is
expected
and
correct.
WRITING
RELATIVE
FILE
DATA
The
commands
used
to
read
and
write
relative
file
data
are the
same
PRINT#,
INPUT#,
and
GET#
commands
used
in
the
preceding
chapter
on
Sequential
files.
Each
command
is
used
as
described
there.
However,
some
aspects
of
relative
file
access
do
differ
from
sequential
file
programming,
and
we
will
cover
those
differences
here.
DESIGNING
A
RELATIVE
RECORD
As
stated
earlier
in
this
chapter,
each
relative
record
has
a
fixed
length,
including
all
special
characters.
Within
that
fixed
length,
there
are
two
popular
ways
to
organize
various
individual
fields
of
informa
tion.
One
is
free-format,
with
individual
fields
varying
in
length
from
record
to
record,
and
each
field
separated
from
the
next
by
a
carriage
return
character
(each
of
which
does
take
up
one
character
space
in
the
record).
The
other
approach
is
to
use
fixed-length
fields,
that
may
or
may
not
be
separated
by
carriage
returns.
If
fixed
length
fields
are
not
all
separated
by
carriage
returns,
you
will
either
need
to
be
sure
a
carriage
return
is
included
within
each
88-character
portion
of
the
record
(88
is
for
BASIC
2,160
is
for
BASIC
7).
If
this
is
not
done,
you
will
have
to
use
the
GET#
command
to
read
the
record,
at
a
significant
cost
in
speed.
Since
each
relative
record
is
most
easily
written
by
a
single
PRINT#
statement,
the
recommended
approach
is
to
build
a
copy
of
the
current
record
in
memory
before
writing
it
to
disk.
It
can
be
collected
into
a
single
string
variable
with
the
help
of
BASIC'S
many
60

Table of Contents

Other manuals for Commodore 1581

Related product manuals