Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 12
Reading Tape Records
.
WHILE LOOP = 1 DO
BEGIN
RCOUNT := 2048;
CALL READX(TAPE^NUM,SBUFFER,
RCOUNT,COUNT^READ);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(TAPE^NUM,
ERROR);
IF ERROR = EOF THEN LOOP := 0
ELSE ........;
END
ELSE
BEGIN
!Process the record block returned in BUFFER.
END;
END;
The first, second, and third reads each transfer 1024 bytes into SBUFFER, return 1024
in COUNT^READ, and set the condition code to CCE (the no-error condition code).
The fourth read operation encounters an EOF mark; nothing is transferred into
SBUFFER, 0 is returned in COUNT^READ, and the condition code is set to CCG. The
FILE_GETINFO_ procedure returns 1 in the error variable, informing the process that
the EOF mark is reached.
If the value passed in the read-count parameter is not enough to read an entire
record block, an error indication is returned to the application. For example, a record
block on tape contains 1024 bytes of data and a read of 256 bytes is requested:
RCOUNT:= 256;
CALL READX (TAPE^NUM,
SBUFFER,
RCOUNT,
COUNT^READ);
IF < THEN !Error encountered
BEGIN
CALL FILE_GETINFO_(TAPE^NUM,
BUFFER);
.
.
059CDT .CDD
EOF1Start 2 3
BOT
Record
Block
Record
Block
Record
Block
Record
Block
EOF