Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 78
Writing to a Multiple-File Unlabeled Tape
3. Write records to the tape:
WHILE DONE = 0;
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 end of the new file and the new end
of information on the tape.
CALL CONTROL(TAPE^NUM,
WRITE^EOF);
IF <> THEN ...
CALL CONTROL(TAPE^NUM,
WRITE^EOF);
IF <> THEN ...
Appending Records to a Multiple-File Tape
Appending records to a multiple-file tape is the same as appending to a single-file tape
except that you need to space forward to the end of the last file on the tape. That is,
you must position the tape before the two EOF marks rather than between them. The
following sequence explains how to do this:
1. Find the double EOF marks that denote the end of information on the tape. Again,
you can do this by 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 two EOF marks that denote the end of 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 ...