NOTE
When DOPEN is used on an existing file, specifica-
tion of the record length is optional. If specified, it
must match the record length set at the time the file
was created or an error condition will result.
When a file is expanded in this manner, the required side sectors are also
created. Side sectors are transparent to the user since they are automatically
generated and accessed by the DOS.
ACCESSING A RELATIVE FILE
In order to make the relative file system practical, the user must be able to
access the file for reading and writing of data. Both of these operations are
simplified by relative files and both may use the RECORD command for positioning
to the desired record before the operation.
To write data to a predetermined record in a file, a constant may be used in the
positioning (line 130) as follows:
110 DOPEN#1,”FILE1”,D0
120 GOSUB 190
130 RECORD#1,25
140 GOSUB 190
150 PRINT#1,”RECORD 25”
160 GOSUB 190
170 DCLOSE#1
180 END
190 IF DS<20 THEN RETURN
200 PRINT DS$
210 IF DS=50 THEN RETURN
220 STOP
The resulting record would appear as follows:
1 2 3 4 5
12345678901234567890123456789012345678901234567890
--------------------------------------------------
RECORD 25*
--------------------------------------------------
Where * represents a carriage return (CHR$(13)).
66