A Note on Record Addressing
Usually, the DBMS creates large physical records, or blocks, on its direct access files. These records are
used as containers for logical records. Typically, each physical record has many logical records. Here, we
assume that each physical record is addressed by its relative record number (RRN). Thus, a logical record
might be assigned to physical record number 7, 77, or 10,000. The relative record number is thus the
logical record’s physical address. If each physical record has more than one logical record, the address
must also specify where the logical record is within the physical record. Thus, the complete address for a
logical record might be relative record number 77, byte location 100. This means the record begins in
byte 100 of physical record 77.
To simplify the illustrations in this text, we assume that there is only one logical record per physical record,
so we need not be concerned with byte offsets within physical records. Although this is unrealistic,
it limits our discussion to the essential points.
How Can Linked Lists Be Used to Maintain Logical Record Order?
Linked lists can be used to keep records in logical order that are not necessarily in physical order. To
create a linked list, we add a field to each data record. The link field holds the address (in our illustrations,
the relative record number) of the next record in logical sequence. For example, Figure H-3 shows
the ENROLLMENT records expanded to include a linked list; this list maintains the records in StudentNumber
order. Notice that the link for the numerically last student in the list is zero.
Figure H-4 shows ENROLLMENT records with two linked lists: One list maintains the StudentNumber order
and the other list maintains the ClassNumber order. Two link fields have been added to the records,
one for each list.