Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 33
Locking, Renaming, Caching, Closing, Purging, and
Altering Entry-Sequenced Files
To allow the appended record to be randomly accessed, you can acquire the record
address (combination of block number and record number) by issuing a
FILE_GETINFOLIST_ call as follows:
LITERAL MAX^RESULT^LENGTH = 34;
INT(32) RECORD^ADDRESS := 0D;
.
.
NUMBER^OF^ITEMS := 1;
GET^RECORD^ADDRESS := 12;
CALL FILE_GETINFOLIST_(FILE^NUM,
GET^RECORD^ADDRESS,
NUMBER^OF^ITEMS,
RECORD^ADDRESS,
MAX^RESULT^LENGTH);
Here, item 12 is passed to the procedure to return the current-record pointer. The
procedure returns the current-record pointer (containing the record address) in
RECORD^ADDRESS. Your program can then use this address to access the stored
record using the READ[X] procedure:
CALL POSITION(FILE^NUM,
RECORD^ADDRESS);
CALL READX(FILE^NUM,
BUFFER,
BUFFER^LENGTH,
BYTES^READ);
Locking, Renaming, Caching, Closing, Purging, and Altering
Entry-Sequenced Files
The operations of locking, renaming, closing, and purging entry-sequenced files,
altering entry-sequenced-file attributes, and avoiding unnecessary cache flushes of
entry-sequenced files are the same as for any disk file. See Using Unstructured Files
earlier in this section.
Monitoring Writes to a Disk File
You can use operation 27 of the CONTROL procedure to detect write operations to a
disk file. This feature is typically used with entry-sequenced files to check for writes to
the end of the file.
A typical example of the use of this feature is with a file that contains a log of
instructions written to the file by various processes. Your process needs to read these
instructions from the file and therefore needs to know when a write has taken place.