Enscribe Programmer's Guide

namelen, file^code, pri^extent,
sec^extent, , file^type, , , buffer^size);
Accessing Unstructured Files
This subsection discusses the pointers and different types of access associated with unstructured
files.
File Pointers
Three major pointers are associated with an Enscribe unstructured file:
Current-record pointer
Specifies the RBA of the location that was most recently read from or written to.
Next-record pointer
Specifies the RBA of the next location to be read from or written to.
EOF pointer
Specifies the RBA of the next even numbered byte following the last data byte in the file unless
the odd unstructured option has been set for the file. If the odd unstructured option is set, the
EOF occurs at the next sequential byte after the last data byte whether it is odd or even
numbered.
When you open an unstructured file, both the current-record and next-record pointers point to the
first byte in the file (RBA zero).
Separate current-record and next-record pointers are associated with each opening of an
unstructured disk file so that if the same file is opened several times simultaneously, each opening
provides a logically separate access. The current-record and next-record pointers reside in the file's
access control block (ACB) in the application process environment.
A single EOF pointer, however, is associated with all opens of a given unstructured disk file. This
permits data to be appended to the end of a file by several different accessors. The EOF pointer
resides in the file's file control block (FCB) in the disk I/O process environment. A file's EOF pointer
value is copied from the file label on disk when the file is opened and is not already open. The
system maintains a working copy of the file's EOF pointer in the FCBs that are in both the primary
and backup system processes that control the associated disk volume.
You can explicitly change the content of the next-record pointer to that of the EOF pointer by
specifying an address of -1 in a FILE_SETPOSITION_ call. When appending to a file, the EOF
pointer is advanced automatically each time a new data record is added to the end of the file.
Note that in the case of partitioned files, the EOF pointer relates only to the final partition containing
data.
A file's EOF pointer is not automatically written through to the file label on disk each time it is
modified. Instead, for unstructured files, it is physically written to the disk only when one of these
events occurs:
A file label field is changed and the autorefresh option is enabled.
The last accessor of the file, closes the file.
The DISK_REFRESH_ procedure is called for the file.
The REFRESH command is executed for the file's volume.
When creating a file by using the FILE_CREATE_ system procedure, you enable or disable the
autorefresh feature by setting bit 10 of the options parameter to 1 or 0, respectively.
When creating a file by using FUP, you enable or disable the autorefresh feature by specifying
REFRESH or NO REFRESH, respectively, in the FUP CREATE command.
When you open a file, the autorefresh feature is enabled or disabled at that time depending upon
what was specified for the file when it was created. You can enable or disable this feature
dynamically during program execution by specifying REFRESH or NO REFRESH, respectively, in
Accessing Unstructured Files 63