Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 22
sequential access is automatic. The current-record pointer still points at relative byte
4096:
I/O operations can also be performed starting at the relative byte pointed at by the
current-record pointer. To read from the current-record pointer, you use the
READUPDATE[X] procedure; to write starting at the current-record pointer, you use the
WRITEUPDATE[X] procedure.
A typical read record, update record, write record back sequence makes use of a
READ[X] call followed by a WRITEUPDATE[X] call. For example, if you follow the
above READX call with a WRITEUPDATEX call that uses the same buffer size as the
READX call, then the record read by the READX call gets written over because the
WRITEUPDATEX call starts writing at the current-record pointer, not the next-record
pointer:
WCOUNT := 512;
CALL WRITEUPDATEX(FILENUM,
SBUFFER,
WCOUNT);
Following the WRITEUPDATEX call, the current-record and next-record pointers
remain unchanged:
To append records to a file, you must position the current-record and next-record
pointers to the end of the file. You do this by supplying the POSITION procedure with
-1 as the byte address:
FILE^POINTERS := -1D;
CALL POSITION(FILENUM,
FILE^POINTERS);
VST013.VSD
VST014.VSD