Sequential Files

In the sequential file access method, new records are appended to the end of the RMS data file. When a record in a sequential file is updated, the modifications are made in place, and when a record is deleted, the one-byte prefix for the record is changed to a deleted status (d). When a sequential file is read, each active record from the beginning of the file is returned to the calling program. Records that have been deleted (or have a zero status) are not returned to the calling program.

If a sequential RMSfile has the Reusing Deleted Records option set, the first record of the RMS data file is reserved by RMS to build a deleted record chain. As records are deleted, they are added to the head of this list. These deleted records are used when adding records to the RMSfile. If there are no deleted records available, RMS appends the record to the end of the RMS data file. Each record in the deleted record list "points" to the next record in the list.

A sequential file can have primary keys. When performing a keyed search, (using dfindk(C-3)), RMS sequentially searches the RMS data file for a record matching the requested key values starting with the first record. Obviously, it is not very practical to have primary keys in a sequential file. They are included to make sequential files consistent with the other file access methods. The RMS user need not know the file organization when using any of the file access functions.

Sequential files can also have secondary key fields. Since the method for performing secondary key indexing is the same for all three file access methods, this is covered in a later section.

Sequential files are not intended to hold the normal data activity of an application. They are more suited for use as temporary files that need to hold data for a short period of time.