EasyManua.ls Logo

Commodore 1570 - Page 71

Commodore 1570
132 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...
BASIC 2.0:
100
INPUT"ENTER RECORD NUMBER";RE
110
OPEN 15,8,15
120
OPEN#3,8,3,
"MYRELFILE,L,"
+ CHR$(88)
130
BL$ =
"(27
shited space chars)"
140
INPUT"NAME";
NA$
145
LN = LEN(NA$)
150
IF
LEN>27
THEN
140
155
NA$ = NA$ + LEFT$(BL$,27 -
LN)
160INPUr'STREET";SA$
165
LN = LEN(SA$)
170
IF
LEN>27
THEN
160
175
SA$ = SA$ + LEFT$(BL$,27 -
LN)
180 INPUT"CITY & STATE"; CS$
185
LN
= LEN(CS$)
190
IF
LN>23
THEN
180
195
CS$ = CS$ + LEFT$(BU,23 -
LN)
200 INPUT"ZIP CODE";ZP$
205
LN
= LEN(ZP$)
210
IF
LN>
10
THEN 200
215 ZP$
=ZP$
+ LEFT$(BL$,
10
-
LN)
220 DA$ = NA$ + SA$ + CS$ + ZP$
260 RH = INT(RE/256)
270
RL
= RE - 256*RH
280 PRINT#15,
"P"
+ CHR$(96 +
3)
+ CHR$(RL) + CHR$(RH)
+CHR$(l)
290 GOSUB 1000:IF
EN
= 50THENPRINT#3)CHR$(255):GOSUB 1000:GOT0280
300
GOSUBIOOO
310 PRINT#3,DA$
320
GOSUBIOOO
330 PRINT#15,
"P"
+ CHR$(96+
3)
+ CHR$(RL) +CHR$(RH) + CHR$(I)
340
GOSUBIOOO
350 GOSUBI000:CLOSE3:CLOSEI5:END
1000INPUT#15,EN,EM$,ET,E
1002 IF
EN<20
THEN RETURN
1010 PRINT"ERROR:"EM$:CLOSE3:CLOSEI5: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
the
optional offset parameter of the Record#
command
to
point
at
a particular byte within a record. However, one warning must
be
made about using the offset this way. 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.
63

Related product manuals