Record file addresses (RFAs)
RFAs are supported on Windows and UNIX.
An RFA is a binary identifier that uniquely identifies the location of a record in a file. It can be used to access previously read records without the use of keys or record numbers. On ISAM files, access is direct without having to read the index.
An RFA in 32-bit form is stored as an alpha or decimal variable consisting of six bytes, as shown in the following diagram:
The first four bytes are the absolute position in the file and are represented as a portable integer. The fifth byte is the RFA use counter, which is a byte that is incremented each time an RFA position is restored by a STORE or WRITE statement. The sixth byte is currently unused.
On terabyte files (created with the TBYTE option to the bldism utility or the ISAMC routine), the first five bytes are the file position represented as a portable integer, and the sixth byte is the RFA use counter.
Static RFAs are only supported for ISAM files.
When creating a file, you can also specify whether each record in that file has a unique, or static, RFA throughout the life of that file. Synergy DBL returns the RFA to your program each time the record is retrieved or accessed. Your program can either ignore the RFA or keep it for subsequent, direct retrieval of records.
Static RFAs are primarily intended for applications that rely heavily on RMS-compatible RFA access, use manual locks together with record compression or variable-length records, or use xfODBC.
Normally, Synergy DBL reuses released data space, thereby eliminating the need to reorganize your ISAM files. Files that use static RFAs, however, may contain deleted data space that is not reusable; you can use the isutl utility with the -i or -vi option to find out how many bytes in your data partition are unusable. (See isutl -i for more information.) If you try to retrieve or access a deleted record by its saved RFA, you’ll get a “Deleted Record” error ($ERR_DELREC).
If you don’t use static RFAs, the following situations may occur:
- An RFA may change on a WRITE statement.
- A new record may have the same RFA as a record whose use count exceeds 128.
- Unlocking a manual lock by RFA after an RFA has changed will either not work or will unlock the wrong record.
- Use of temporary indexes by xfODBC may result in incorrect data being returned.
When you want to free up any unusable file space used by the static RFAs for a file, you can use isutl -ro to reorganize an ISAM file. (See isutl -r for more information.) If you reorganize your ISAM file, the static RFAs for that file are no longer valid.
Using static RFAs adds six bytes of additional storage space per record. Static RFAs are mandatory for Revision 6 ISAM files.
A GRFA is a 10-byte binary identifier that uniquely identifies the location and contents of a record in a file. A GRFA consists of a 4-byte record CRC and a 6-byte RFA. GRFAs are used to access previously read records without the use of keys or record numbers and also detect when the record has changed.
Because the GRFA includes a record CRC, it provides a way for transactions to be validated before being committed. A CRC is derived from the record in order to detect changes; any change to the record generates a different CRC.