EasyManua.ls Logo

Commodore 2031 - Using DOS Support Symbols (> and @)

Commodore 2031
98 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...
110 DOPEN#1,”FILE1”,D0
120 GOSUB 290
130 RECORD#1,25
140 GOSUB 290
150 RECORD#1,25,1:GOSUB 290
160 INPUT#1,A$:GOSUB 290
170 RECORD#1,25,10:GOSUB 290
180 INPUT#1,B$:GOSUB 290
190 RECORD#1,25,30::GOSUB 290
200 INPUT#1,C$:GOSUB 290
210 DCLOSE#1
220 END
290 IF DS<20 THEN RETURN
300 PRINT DS$
310 STOP
Lines 160, 180, and 200 cause the stored values on disk to be read and stored in
A$, B$, and C$, respectively.
It is extremely useful to be able to access a record which is determined during
program operation. The following routine illustrates a procedure to query the
operator for a record number and a data and to write the data to the disk file:
100 PRINT”TYPE RECORD NUMBER AND DATA”
105 INPUT R,D$
110 DOPEN#1,”FILE1”,D0
120 GOSUB 190
130 RECORD#1,(R)
140 GOSUB 190
150 PRINT#1,D$
160 GOSUB 190
170 DCLOSE#1
180 END
190 IF DS<20 THEN RETURN
200 PRINT DS$
210 STOP
Line 130 positions the file pointer to record number (R), specified by the user.
Note that a variable used in the RECORD command must be enclosed in
parenthesis.
Line 150 causes the data stored in D$ to be stored on the disk.
The RECORD command may be omitted if the file is to be accessed sequen-
tially, which saves time during program execution. An example of this occurs
when writing a large data base to the disk file. Assume that the program has
68

Table of Contents

Other manuals for Commodore 2031

Related product manuals