Enscribe Programmer's Guide

8 Entry-Sequenced Files
Enscribe Entry-Sequenced Files
Enscribe entry-sequenced files are designed for sequential access. They consist of variable-length
records that are always appended to the end of the file; as a result, the records in the file are
arranged physically in the order in which they were added to the file.
Figure 19 (page 124) illustrates the structure of an entry-sequenced file.
The primary key of an entry-sequenced file consists of a record's block number (within the file) and
its record number (within the block). When used with FILE_SETPOSITION_, the key is an 8-byte
value in which the block number occupies the leftmost 4 bytes of the key and the record number
occupies the rightmost 4 bytes. When used with POSITION, the key is a 4-byte value whose format
depends on the file's block size, as follows:
Number of bits for recordNumber of bits for blockBlock size
12204096
11212048
10221024
923512
The record’s address is typically used and manipulated internally by the file system, and there is
usually no reason for you to know its value. You can, however, obtain the address of the record
just read or written by using the FILE_GETINFOLIST_ system procedure.
Applicable System Procedures
You use these system procedures to create and access Enscribe entry-sequenced files:
FILE_CREATE_, FILE_CREATELIST_
FILE_OPEN_, FILE_CLOSE_, AWAITIO[X], FILE_AWAITIO64_
FILE_LOCKFILE64_, FILE_LOCKREC64_, FILE_UNLOCKFILE64_, FILE_UNLOCKREC64_,
LOCKFILE, UNLOCKFILE, LOCKREC, UNLOCKREC
FILE_READ64_, FILE_READLOCK64_, FILE_READUPDATE64_, FILE_READUPDATELOCK64_,
READ[X], READLOCK[X], READUPDATE[X], READUPDATELOCK[X]
FILE_WRITE64_, FILE_WRITEUPDATE64_, FILE_WRITEUPDATEUNLOCK64_, WRITE[X],
WRITEUPDATE[X], WRITEUPDATEUNLOCK[X]
FILE_SETKEY_, FILE_SAVEPOSITION_, KEYPOSITION, POSITION, FILE_SETPOSITION_
FILE_GETINFO_, FILE_GETINFOLIST_, FILE_GETINFOLISTBYNAME_, FILE_GETINFOBYNAME_
SETMODE, CONTROL, FILE_CONTROL64_
Types of Access
After creating the file, there are essentially three operations that you can perform:
1. Use FILE_WRITE64_/WRITE calls to add new records to the end of the file.
2. Use FILE_READ64_/READ calls to retrieve records from the file.
3. Use FILE_SETKEY_ or KEYPOSITION calls to specify an alternate-key access path and then
use FILE_READ64_/READ calls to retrieve records that contain the specified alternate-key
value.
You can also use the file and record locking system procedures FILE_LOCKFILE64_,
FILE_LOCKREC64_, FILE_UNLOCKFILE64_, FILE_UNLOCKREC64_, FILE_READLOCK64_, LOCKFILE,
Enscribe Entry-Sequenced Files 123