EasyManua.ls Logo

Commodore 1581 - Reading a Relative Record

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...
170
IF
LEN>27
THEN
160
175
SA$
=
SA$
+
LEFT$(BL$,27
-
LN)
180
INPUT'CITY
&
STATE";
CS$
185LN=LEN(CS$)
190IFLN>23THEN180
195
CS$
=
CS$
+
LEFT$(BL$,23
-
LN)
200
INPtTTZIP
CODE";ZP$
205LN=LEN(ZP$)
210IFLN>10THEN200
215
ZP$
=
ZP$+LEFT$(BL$,10
-
LN)
220
DA$
=
NA$
+
SA$
+
CS$
+
ZP$
260RH
=
INT(RE/256)
270RL=RE-256*RH
280
PRINT#15,"P"
+
CHR$(96
+
3)
+
CHR$(RL)
+
CHR$(RH)
+
CHR$(1)
290
GOSUB1000:IF
EN
=
50THENPRINT#3)CHR$(255):GOSUB1000:GOTO280
300
GOSUB1000
310
PRINT#3,DA$
320
GOSUB1000
330
PRINT#15,"P"
+
CHR$(96
+
3)
+
CHR$(RL)
+
CHR$(RH)
+
CHR$(1)
340
GOSUB1000
350
GOSUB1000:aOSE3:aOSE15:END
1000
INPUT#15,EN,EM$,ET,E
1002
IF
EN<20
THEN
RETURN
1010PRINT"ERROR;"EM$:aOSE3:aOSE15:END
If
field
contents
vary
in
length,
variable
field
lengths
are
often
preferable.
On
the
other
hand,
if
the
field
lengths
are
stable,
fixed
field
lengths
are
preferable.
Fixed
length
fields
are
also
required
if
you
want
to
use
die
optional
offset
parameter
of
the
RECORD#
command
to
point
at
a
particular
byte
within
a
record.
However,
when
any
part
of
a
record
is
written,
DOS
overwrites
any
remaining
spaces
in
the
record.
Thus,
if
you
must
use
the
offset
option,
never
update
any
field
in
a
record
other
than
the
last
one
unless
all
succeeding
fields
will
also
be
updated
from
memory
later.
The
above
programs
are
careful
to
match
record
lengths
exactly
to
the
space
available.
Programs
that
don't
do
so
will
discover
that
DOS
pads
short
records
out
to
full
size
with
fill
characters,
and
truncates
overlong
records
to
fill
only
their
allotted
space.
When
a
record
is
truncated,
DOS
will
indicate
error
51,
"RECORD
OVER
FLOW,"
but
short
records
will
be
accepted
without
a
DOS
error
message.
READING
A
RELATIVE
RECORD
Once
a
relative
record
has
been
written
properly
to
diskette,
reading
it
back
into
computer
memory
is
fairly
simple,
but
the
proce
dure
again
varies,
depending
on
whether
it
uses
fixed
or
variable
length
fields.
Here
are
the
program
lines
needed
to
read
back
the
64

Table of Contents

Other manuals for Commodore 1581

Related product manuals