Guardian Programmer's Guide

Table Of Contents
Communicating With Magnetic Tape
Guardian Programmer’s Guide 421922-014
12 - 54
Writing the Program
the record is put into the tape buffer and written to tape as a partial record block. If
the user chooses to enter more records, the procedure blocks each record into the
tape buffer until either the buffer contains four records or the user declines to enter
more records. At this point the procedure writes the tape buffer to tape—one
record block.
The OPEN^TAPE^FILE procedure is called from either the READ^RECORD or
APPEND^RECORD procedures to open the tape file using the CLASS TAPE
DEFINE appropriate for the selected function. If append is selected, this
procedure uses the =APPEND^TAPE DEFINE. If create is selected, this
procedure uses the =CREATE^TAPE DEFINE, which is like the =APPEND^TAPE
DEFINE except that it also writes new file labels to the tape. If read is selected,
this procedure uses the =READ^TAPE DEFINE.
This procedure also sets buffered mode for the tape file.
The FILE^ERRORS and FILE^ERRORS^NAME procedures respond to file system
errors. They simply print out the error number and stop the program.
Procedure ILLEGAL^COMMAND informs the user of an invalid command selection
and then returns to the LOGGER procedure to prompt for another function.
?INSPECT,SYMBOLS,NOMAP,NOCODE
?NOLIST, SOURCE $TOOLS.ZTOOLD04.ZSYSTAL
?LIST
LITERAL BUFSIZE = 512;
LITERAL TBUFSIZE = 2048;
LITERAL MAXFLEN = ZSYS^VAL^LEN^FILENAME;
LITERAL ABEND = 1;
STRING .SBUFFER[0:BUFSIZE]; !Buffer for terminal I/O
INT TERMNUM; !Terminal file number
INT TAPENUM; !Tape file number
STRING CMD; !Function executing
STRING .S^PTR; !String pointer
INT .TBUFFER[0:(TBUFSIZE/2 - 1)]; !Buffer for tape I/O
INT .LREC0 := @TBUFFER[0]; !Integer pointers to
INT .LREC1 := @TBUFFER[256]; ! records in tape
INT .LREC2 := @TBUFFER[512]; ! buffer
INT .LREC3 := @TBUFFER[768];
INT INDEX; !Index into record block
INT(32) RBLOCK; !Record block number
STRUCT .LOG^RECORD; !Record structure
BEGIN
STRING DATE[0:7];
STRING COMMENTS[0:503];
END;
INT .RECORD^POINTER := @LOG^RECORD[0];
STRUCT .CI^STARTUP; !Startup message