EasyManua.ls Logo

Commodore 1581 - Writing the 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...
string-handling
functions,
and
then
all
written
out
at
once
from
that
variable.
Here
is
an
example.
If
we
are
writing
a
4-line
mail
label,
consist
ing
of
4
fields
named
"NAME,"
"STREET,"
"CITY
&
STATE,"
and
"ZIP
CODE,"
and
have
a
total
record
size
of
87
characters,
we
can
organize
it
in
either
of
two
ways:
WITH
FIXED
LENGTH
FIELDS
Field
Name
NAME
STREET
CITY
&
STATE
ZIP
CODE
Total
length
Length
27
characters
27
characters
23
characters
10
characters
87
characters
WITH
VARIABLE
LENGTH
FIELDS
Field
Name
NAME
STREET
CITY
&
STATE
ZIP
CODE
Potential
length
Edited
length
Length
31
characters
31
characters
26
characters
11
characters
99
characters
87
characters
With
fixed
length
records,
the
field
lengths
add
up
to
exactly
the
record
length.
Since
the
total
length
is
just
within
the
Input
buffer
size
limitation,
no
carriage
return
characters
are
needed.
With
variable
length
records,
you
can
take
advantage
of
the
variability
of
actual
address
lengths.
While
one
name
contains
27
letters,
another
may
have
only
15,
and
the
same
variability
exists
in
street
and
city
lengths.
Although
variable
length
records
lose
one
character
per
field
for
carriage
returns,
they
can
take
advantage
of
the
difference
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).
BASIC
7.0:
100
INPUT'ENTER
RECORD
NUMBER";RE
110:
120
DOPEN#3,"MYRELFILE",L88
130CR$
=
CHR$(13)
140
INPUTNAME";
NA$
150
IF
LEN(A$)>30
THEN
140
160
INPUT'STREET";SA$
170
IF
LEN(SA$)>30
THEN
160
61

Table of Contents

Other manuals for Commodore 1581

Related product manuals