


Relative files are generally used to store data where low overhead is required. Records are available by record number. On machines that directly support relative files (such as VMS), relative files are used.
On other machines (MS-DOS, UNIX, and MPE/iX systems), relative files are treated the same as binary sequential files. Each record is physically located at its record number, and writing record 1 and record 1000 causes 999 blank records to be written. Block sizes are ignored, and each I/O uses the record size to determine how many bytes to transfer.
Records may be either fixed-length or variable-length. Two bytes indicating record size are placed in front of each variable-length record when it is written, and each record is padded to the maximum size so that records can be retrieved randomly in an efficient fashion.
When a record is deleted, the physical record is actually filled with up to 256 null characters (LOW-VALUES in ACUCOBOL-GT). (This deleted record marker can be changed through the use of the REL-DELETED-VALUE configuration variable. See Appendix H.) Note that ACUCOBOL-GT checks only the first 256 characters of the record to determine if it is deleted.
Relative files may be assigned only to disk files.
On many (but not all) systems, the runtime system allows a relative file to be opened for input when the user does not have write-access to the file.