Guardian Programmer's Guide

Table Of Contents
Communicating With Disk Files
Guardian Programmer’s Guide 421922-014
5 - 8
Queue Files
When a new key is added to the data file, new alternate keys are automatically added
to the alternate-key file (unless the alternate key is defined as not automatically
updated).
Unlike primary keys, alternate keys can be duplicated if the file is designated to accept
duplicate keys. Duplicate keys are added to the alternate-key file in the same order as
the corresponding key in the primary file. Figure 5-4 shows examples of duplicate
keys.
Duplicate alternate keys can, for example, provide keyed access for two people with
the same name; their primary keys would, of course, have unique values such as a
bank account number or social security number.
Queue Files
A queue file is a special type of key-sequenced disk file that can function as a queue.
Processes can queue and dequeue records in a queue file.
Queue files contain variable-length records that are accessed by values in designated
key fields. Unlike other key-sequenced files, queue files have primary keys but cannot
have alternate keys. The primary key for a queue file includes an eight-byte
timestamp; you can add a user key if desired. The disk process inserts the timestamp
when each record is inserted into the file, and maintains the timestamp during
subsequent file operations.
Figure 5-4. An Alternate-Key File
VST026.VSD