User`s manual
before CLOSEing your data channels. The error channel should be OPENed iust
and CLOSEd last of all your files! That will keep your programs out of trouble.
If you close the error channel while other files are OPEN, the disk drive
will CLOSE them for you, but BASICwill still think they are open (unless you
CLOSE them properly), and let you to try to write to them.
NOTE: If your BASIC program leads you into an error condition, all files
are CLOSEd in BASIC, without CLOSEing them on your disk drive! This
is a very dangerous condition. You should immediately type the statement
CLOSE 15: OPEN 15, 8, 15: CLOSE 15. This will re-initialize your drive
and make all your files safe.
5. SEQUENTIAL FILES
OPEN
Sequential files on the disk drive work exactly like they do on cassette
tape, only much faster. They are limited by their sequential nature, which means
they must be read from beginning to end. Data is transferred byte by byte,
through a buffer, onto the magnetic media. To the disk drive all files are created
equal. That is, sequential files, program files, and user files all work the same on
the disk. Only program files can be LOADed, but that's really the only
difference. Even the directory works like this, except that it is read-only. The
only difference is with relative files.
FORMAT FOR OPENING A SEQUENTIAL FILE:
OPEN file#, device#, channel#, "O:name,type,direction"
The file number is the same as in all your other applications of the OPEN
statement, and it is used throughout the program to refer to this particular file.
The device# is usually 8. The channel # is a data channel, number 2 through 14.
It is convenient to use the same number for both the channel# and file#, to
keep them straight. The name is the file name (no wild cards or pattern matching
if you're creating a write file). The type can be any of the ones from the chart
below, at least the first letter of each type. The direction must be READ or
WRITE, or at least the first letter of each.
FILE TYPE MEANING
PRG
SEQ
USR
REL
Program
Sequential
User
Relative (not implemented in BASIC2.0)
19