Enscribe Programmer's Guide
Figure 18 Using Generic Positioning With a Queue File
Process
A
Process
B
READUPDATELOCK Get Record "TA1000"
File is Empty
(request is retained)
Disk process returns record "TA1001"
READUPDATELOCK
WRITE:
Record "TA1001" inserted
File is Empty
(request is retained)
READUPDATELOCK
(request is retained)
WRITE:
Record "TB1002" inserted
Disk process returns record "TA1003"
WRITE:
Record "TA1003" inserted
File is Empty
(request is retained)
READUPDATELOCK
Note that the second insertion does not cause Process A to be awakened, because the user key
in the new record does not satisfy the key selection criteria. The third insertion does satisfy the
criteria, however, so the disk process returns the record to Process A and reawakens Process A.
This example also illustrates how an application could use multiple servers or dequeuing processes
to read from the same file. Each server could access a subset of the file as designated by the
high-order field of the primary key (in this case, records with “TA” in the high-order key are being
dequeued by process A). In this manner, the high-order key file can be used to logically partition
the file across multiple servers.
The high-order key field can also be used to specify relative priority of a queued record. Records
with smaller valued keys are positioned before those of higher values. Thus, a server that always
reads from the start of the file will dequeue records in ascending key order. This permits prioritization
of records within the Queue File.
Exact Positioning
The use of exact positioning is not typical for queue files, since applications usually access queue
files in a specified order rather than by exact key value. You can, however, use exact positioning
for a queue file. For example, you might use the FILE_READ64_/READ[X] procedure to access
specific records within the file without changing their placement in the queue file, and then delete
specific records after examining them.
Using the Current Key
The current key for a queue file has meaning only after a FILE_READ64_/READ[X] operation. Unlike
standard key-sequenced files, you cannot assume the current key is accurate after the
FILE_READUPDATELOCK64_/READUPDATELOCK[X] operation.
116 Queue Files