4.2.1 RMSfile Components



RMS provides the capabilities missing from the MS-DOS file system. It uses standard MS-DOS files and puts a record and data field structure on top of that system. It also provides a method of generating indexes for quickly referencing data records by value. Two or possibly three different MS-DOS files are used to represent one RMSfile: an RMS data file, an RMS dictionary file, and an optional RMS index file.

The RMS data file contains the actual data records. Data records are stored in binary form; data types such as integer and money are stored in their binary representation, not as their ASCII character equivalent. All records in one RMSfile have the same length. This allows any record to be retrieved by its record number.

Each record in the RMS data file has a one-byte prefix. This prefix is completely invisible to anyone who uses the RMS functions, but it would be discovered if MS-DOS utilities were used to examine RMSfiles. This one-byte prefix records the record status. A record can exist in the file (a), be deleted from the file (d), or a record never existed there (0). Again, this prefix is used internally by RMS; the RMS programmer does not have to contend with the prefix.

The RMS dictionary file has the same name as the RMS data file with a .d appended. This file contains the dictionary for the RMSfile. The dictionary describes the file access method for the RMSfile, each data field in a record, the primary key fields, and all the secondary index key fields. The dictionary is used by RMS when reading and writing records in the RMSfile. The contents of the dictionary can be accessed with functions provided by RMS.

The RMS index file has the same name as the RMS data file with a .i appended. This file contains all the B-tree indexes for the RMSfile. Any of the file access methods may have secondary keys. A B-tree index is created for each secondary key. If the RMSfile is an indexed file, there is an additional index for the primary key. All indexes for an RMSfile are stored together in one RMS index file. The index file is not created or used if there are no indexes associated with the RMSfile.