Enscribe Programmer's Guide
item^list, item^list^len, value^list,
$LEN(value^list), error2);
END;
Accessing Relative File
The following paragraphs discuss the file pointers and access methods for Enscribe relative files.
The File Pointers
Separate next-record and current-record pointers are associated with each opening of a relative
disk file so that if the same file is open several times simultaneously, each opening will provide a
logically separate access. The next-record and current-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 openings of a given relative 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.
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 POSITION or FILE_SETPOSITION_ call.
When appending to a file, the EOF pointer is advanced automatically each time a new block is
added to the end of the data in 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 relative 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 closes the file.
• The DISK_REFRESH_ procedure is called for the file.
• The REFRESH command is executed for the file's volume.
When using the FILE_CREATE_ procedure, you enable the autorefresh option by setting options
bit 13 to 1. When using FUP, you enable the autorefresh option by issuing a SET REFRESH
command.
For files created with the autorefresh option disabled, you can subsequently enable autorefresh by
issuing a FUP ALTER command containing the REFRESH ON parameter
Effects of File-System Procedures on Pointers
The following paragraphs briefly describe how each applicable system procedure affects the
current access path, current-record pointer, and next-record pointer.
FILE_OPEN_
Sets the current access path to the primary-key field.
Changes the content of the current-record and next-record pointers so that they both point to
record number zero.
FILE_SETPOSITION,POSITION
Sets the current access path to the primary-key field.
Changes the content of the current-record and next-record pointers so that they both point to
the particular record identified by the specified record number.
Record number -1 resets both pointers to the current EOF position.
Record number -2 resets both pointers to an available empty record in the file.
144 Relative Files