![Commodore 1531 Datassette User Manual Download Page 16](http://html1.mh-extra.com/html/commodore/1531-datassette/1531-datassette_user-manual_2643350016.webp)
FILE HANDLING
Experienced programmers may write more sophisticated programs that use
large amounts of data. This data may be stored on a file on the cassette. The
commands to handle data files are explained below.
Files of data can be written to and read from the DATASSETTE™ . These
CANNOT be LOADED like a program, but they can be read by a program. To
communicate with the DATASSETTE™ , use the OPEN command.
OPEN A,B,C,"NAME"
This will OPEN a logical file where NAME identifies the file and:
A Choose a reference number from 1 to 255. If your program uses more
than one file, each file must have its own file number.
B Must be 1 for the DATASSETTE™. This is your device code.
C Specifies whether the program will WRITE to or READ from this file,
coded as follows:
if C = 0 read from tape
C= 1 write to tape with an End-Of-File marker to be written when the file is
CLOSED.
C = 2 write to tape with an End-Of-Tape marker to be written when the file is
CLOSED.
Example: OPEN5,1,1,"TEST"
will OPEN a file named "TEST" with a file number of 5. The program will
WRITE to this file on the cassette.
If a value of 2 is chosen for C and "TEST" is chosen for the name, this will
WRITE on End-Of-Tape marker at the end of the file. If the computer is then
told to read a file which is after the file "TEST", then when the computer has
passed TEST it will respond with: FILE NOT FOUND ERROR and stop. This is
because the file "TEST" tells the computer that the tape has ended —
regardless of whether it has or not — so the computer thinks that there are no
14 more programs on the tape.