Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 77
Writing to a Multiple-File Unlabeled Tape
Writing to a Multiple-File Unlabeled Tape
Writing records to a multiple-file unlabeled tape reel is similar to writing to a single-file
tape reel except that you need to be sure that you write to the appropriate file on the
tape. You can add a file to the end of the tape or append records to the last file on the
tape. You can find the end of the last file on the tape by searching for two consecutive
EOF marks.
Adding Files to the End of a Multiple-File Tape
To append a file to the information already on an unlabeled tape, your program must
do the following:
1. Find the double EOF marks that denote the end of information on the tape. One
way of doing this is to keep spacing forward one file at a time, reading the first
record of each file. If the READ[X] call returns error number 1 (end-of-file
warning), then you have reached the end of the tape. The following code fragment
positions the tape immediately after the last EOF mark on the tape:
LITERAL SPACE^FWD^FILES = 7,
SPACE^BACK^FILES = 8,
WRITE^EOF = 2;
.
.
WHILE NOT END^OF^TAPE DO
BEGIN
NUMBER^OF^FILES := 1;
CALL CONTROL(TAPE^NUM,
SPACE^FWD^FILES,
NUMBER^OF^FILES);
IF <> THEN ...
READX(TAPE^NUM,
SBUFFER,
RCOUNT,
COUNT^READ);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(TAPE^NUM,
ERROR);
IF ERROR = 1 THEN END^OF^TAPE := YES
ELSE ... !other error
END;
END;
2. Space backward one EOF mark to position the tape between the two EOF marks:
NUMBER^OF^FILES := 1;
CALL CONTROL(TAPE^NUM,
SPACE^BACK^FILES,
NUMBER^OF^FILES);
IF <> THEN ...