Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 37
Entry-Sequenced File Programming Example
The APPEND^RECORD procedure contains additional code to return the record
address and display it on the terminal. The user can use this address to randomly
access the record.
The code for this program follows.
?INSPECT,SYMBOLS,NOMAP,NOCODE
?NOLIST,SOURCE $SYSTEM.ZSYSDEFS.ZSYSTAL
?LIST
LITERAL MAXFLEN = ZSYS^VAL^LEN^FILENAME; !maximum file-name
! length
LITERAL BUFSIZE = 512;
STRING .SBUFFER[0:BUFSIZE]; !I/O buffer (one extra char)
STRING .S^PTR; !pointer to end of string
STRING .LOGNAME[0:MAXFLEN - 1]; !name of log file
INT LOGLEN; !length of log name
INT LOGNUM; !log file number
STRING .TERMNAME[0:MAXFLEN - 1]; !terminal file
INT TERMLEN; !length of term name
INT TERMNUM; !terminal file number
?NOLIST,SOURCE $SYSTEM.SYSTEM.EXTDECS0(INITIALIZER,
? PROCESS_GETINFO_,FILE_OPEN_,WRITEREADX,WRITEX,
? PROCESS_STOP_,READX,POSITION,DNUMOUT,FILE_GETINFO_,
? READUPDATEX,WRITEUPDATEX,DNUMIN,FILE_GETINFOLIST_)
?LIST