Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 19
Relative-File Programming Example
The READ^RECORD procedure prompts the user for the record number of the first
record to be read instead of always starting with the first record in the file.
The LOGGER and GET^COMMAND procedures support the “u” option for
updating a record.
The code for this program appears on the following pages.
?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
INT LOGNUM; !log file number
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)
?LIST