Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 79
Writing to a File on Multiple Unlabeled Tape Reels
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 two EOF marks to position the tape at the end of the last file on
the tape:
NUMBER^OF^FILES := 2;
CALL CONTROL(TAPE^NUM,
SPACE^BACK^FILES,
NUMBER^OF^FILES);
IF <> THEN ...
3. Write records to the tape:
WHILE NOT DONE;
BEGIN
.
.
CALL WRITEX(TAPE^NUM,
SBUFFER,
WCOUNT);
IF <> THEN ...
.
.
IF <no more to write> THEN DONE := 1;
END;
4. Write two EOF marks to the tape to signify the new end of the file and the new end
of i
nformation on the tape:
CALL CONTROL(TAPE^NUM,
WRITE^EOF);
IF <> THEN ...
CALL CONTROL(TAPE^NUM,
WRITE^EOF);
IF <> THEN ...
Writing to a File on Multiple Unlabeled Tape Reels
If your program must deal with files that are too large to fit on a single tape reel, then
your program must be able to recognize the end of the tape when writing and to
identify the mounted tape reel when reading.