Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 82
Reading From a Single-File Unlabeled Tape
Reading From a Single-File Unlabeled Tape
When reading records from a tape reel containing one file, your program must do the
following:
1. Space forward or backward to the record that you intend to read. If you try to
space backward too far, the tape stops at the BOT sticker and the file system
returns error 154. If the program is allowed to continue, it will then read the first
record. If you try to space forward too far, the CONTROL procedure will return an
end-of-file error (error 1). For example:
LITERAL SPACE^FWD^RECORDS = 9;
.
.
NUMBER^OF^RECORDS := 27;
CALL CONTROL(TAPE^FILE,
SPACE^FWD^RECORDS,
NUMBER^OF^RECORDS);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(TAPE^FILE,
ERROR);
CASE ERROR OF
BEGIN
"1" -> ... !end of file
"154" -> ... !BOT
OTHERWISE -> ... !other error
END;
END;
2. Read the record:
CALL READX(TAPE^FILE,
SBUFFER,
RCOUNT,
COUNT^READ);
IF <> THEN ...