Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 101
Accessing an Unlabeled Tape File: An Example
! Check for incomplete record block. If this record
! is blank, set INDEX 4 in preparation for reading
! the next record block. Also set SBUFFER to "Y" in
! case this is the first record selected:
IF LOG^RECORD.SEQ^NUM = " " THEN
BEGIN
INDEX := 4;
SBUFFER[0] ':=' "Y";
END
ELSE
! Process the log record:
BEGIN
! Display date from the record:
CALL WRITEX(TERMNUM,LOG^RECORD.DATE,8);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
! Display comments and increment the record
! counter:
CALL WRITEX(TERMNUM,LOG^RECORD.COMMENTS,502);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
INDEX := INDEX + 1;
! Prompt the user to read the next record:
PRINT^BLANK;
SBUFFER ':='
"Do You Want To Read the Next Record (y/n) "
-> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,
@S^PTR '-' @SBUFFER,
BUFSIZE,COUNT^READ);
IF <> THEN CALL FILE^ERRORS(ERROR);
END;
END
UNTIL (NOT (SBUFFER[0] = "y" OR SBUFFER[0] = "Y"))
OR INDEX = 4;
! No more records in this record block. Reset record
! count to 0 and read next record block, if requested:
INDEX := 0;
END
UNTIL NOT (SBUFFER[0] = "y" OR SBUFFER[0] = "Y");
END;