Commodore 2040 User Manual page 72

Cbm 5 1/4-inch dual floppy disk drives
Hide thumbs Also See for 2040:
Table of Contents

Advertisement

Spanning is a key feature of relative files which aids in reducing the number of disk read/
write operations required to find and retrieve data. Before explaining how this feature of
DOS 2 and 2.5 improves time utilization efficiency, we need to examine how I/O channels
are utilized by relative files:
When a channel is opened to a previously existing file, the DOS will position to
the first record provided that the given parameters match properly. The record
length variable is not necessary on the OPEN if the file is already in existence, but
the DOS causes a check to be made against the record size that was originally
made in the DOPEN statement creating the file.
If
these do not match, then error
50-record not present-will be generated.
The relative channel requires three memory buffers from the system, whereas
sequential files only require two. Since there are twelve channels in the system
and two of these are used in directory searches and internal functions, only three
relative channels can be open at one time. The highest number of buffers that can
be used is ten, which limits the total number of channels which can be open at
anyone time.
If
a record was found to be on the boundary between two data blocks, that is, starting in
one data block and finishing in another, then the DOS would read the first segment as well
as any following records in the second data block. In practice, the records of most relative
data files will span across data blocks. The only exceptions are record size 1, 2, 127, and
254. These divide evenly into the 254 size of the data block and spanning is unnecessary.
This method of spanning has the advantage of requiring no system memory overhead aside
from that required for the side sector blocks in the relative files. When a record is written
upon through the PRINT# statement, the data block is not immediately written out. It is
only written out when the DOS moves beyond the particular data block in which that
record resides. This can occur through successive printing to sequential records, or when
positioning to another record outside of that particular block.
Because of the spanning feature, it is recommended that two channels not be open to a rela-
tive file at the same time if either channel will be writing to the same file. An update may be
made in the channel's particular memory buffer area, but the change may not be made on
disk until the DOS moves that particular data block. There is no restriction on this, how-
ever, and in certain instances where the file is only read from, it may be advantageous to
have more than one channel open to a single relative file.
The DOS terminates printing to a record by detecting the EOI signal which is generated with
each PRINT# statement.
If
the PRINT statement goes over the maximum record size, error
51-record overflow-will be generated. Any data overflow will be truncated to fit the num-
ber of characters specified by the record size and the DOS will position to the next record in
sequence. If the print statement contains less characters than the record size, the remaining
positions within that record will be filled with nulls. Consequently, when positioning to a
record for input the EOI signal is generated from the DOS to the computer when the last
non-zero is transmitted. Should the programmer desire to store binary information, a record
terminator such as carriage return will have to be used and the record size increased by one
character to accommodate the terminator.
While the DOS
is
generating new data blocks for relative files, the requested record number
is compared to the number of data blocks left on the diskette. If the resulting number of
data blocks is greater than what is left on the diskette, then error 52-file too large-is
generated.
71

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

304040408050

Table of Contents