EasyManua.ls Logo

Commodore 1541-II - Writing the Record

Commodore 1541-II
104 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...
between
maximum
field
length
and
average
field
length.
A
program
that
uses
variable
record
lengths
must
calculate
the
total
length
of
each
record
as
it
is
entered,
to
be
sure
the
total
of
all
fields
doesn't
exceed
the
space
available.
WRITING
THE
RECORD
Here
is
an
example
of
program
lines
to
enter
variable
length
fields
for
the
above
file
design,
build
them
into
a
single
string,
and
send
them
to
record
number
RE
in
file
number
3
(assumed
to
be
a
relative
file
that
uses
channel
number
3).
150CR$
=
CHR$(13)
2000
INPUT4
4NAME";NA$
2010
IF
LEN(NA$)>30
THEN
2000
2020
INPUT4
'STREET"
;SA$
2030
IF
LEN(SA$)>30
THEN
2020
2040
INPUT44CITY
&
STATE";CS$
2050
IF
LEN(CS$)>25
THEN
2040
2060
INPUT4
4ZIP
CODE";ZP$
2070
IF
LEN(ZP$)>10
THEN
2060
2080
DAS
=
N
A$
+
CR$
+
S
A$
+
CR$
+
CS$
+
CR$
+
ZP$
2090
IF
LEN(DA$)<87
THEN
2120
2100
PRINT44RECORD
TOO
LONG"
2110
GOTO
2000
2120RH
=
INT(RE/256)
2130RL
=
RE-256*RH
2140
PRWT#15,44F'+CHR$(96
+
3)
+
CHR$(RL)
+
CHR$(RH)
2150
GOSUB
59990
2160PRINT#3,DA$
2170
GOSUB
59990
2180
PRINT#15,44P"
+CHR$(96
+
3)
+
CHR$(RL)
+
CHR$(RH)
2190
GOSUB
59990
Carriage
Return
Enter
fields
And
check
length
of
each
Build
output
data
string
Check
its
length
If
too
long
overall
Calculate
record
number
Position
to
record
number
RE
Check
for
disk
errors
Send
data
to
it
Re-position
for
safety
To
use
the
above
program
lines
for
the
version
with
fixed
length
fields,
we
would
alter
a
few
lines
as
follows:
150
160BL$
=
"
2000
INPUT44NAME";NA$
2005LN
=
LEN(NA$)
2010
IF
LEN(NA$)>27
THEN
2000
2015
NA$
=
NA$
+
LEFT$(BL$,27-LN)
2020
INPUT<4STREET";SA$
2025LN
=
LEN(SA$)
Not
needed
this
time
27
shifted
space
characters
Checking
for
different
lengths
And
padding
to
preset
sizes
62

Table of Contents

Related product manuals