Enscribe Programmer's Guide
7 Queue Files
Enscribe Queue Files
An Enscribe 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 8–byte timestamp; you can add a user key if desired.
The disk processes inserts the timestamp when each record in inserted into the file and maintains
the timestamp during subsequent file operations.
Queue files provide these features:
• Access by multiple requester or queuing processes, with multiple servers or dequeuing processes
allowed. Queue files are typically shared between multiple write processes and one read
process, and are typically used for fairly low volume work.
CAUTION: All waiting readers are dispatched for every transaction or queue read. Use of
queue files with multiple sub-queues can cause high utilization of CPU resources by the disk
process and significantly affect performance.
• Protection against data loss with TMF. TMF is the main functional component of the TM/MP
product.
• Flexible record ordering and selection; records can be prioritized; classed, or grouped as
needed by an application; the default ordering is approximately first-in first-out (using the
timestamp as the primary key).
• Record-level locking to prevent incomplete information from being accessed and to ensure
that only one reader dequeues a specific record.
• Notification when new records are added to the file.
These restrictions apply to queue files:
• Queue files cannot be SQL objects.
• You cannot define alternate keys or partitions for queue files.
The first part of this section describes queue file structure and discusses how to access queue files.
The remainder of the section contains examples showing how to create, open, and access queue
files.
NOTE: Enscribe queue files should not be confused with Queue Manager queue files as described
in the Queue Manager Manual. Despite the similarity in their names, they are entirely different
types of files.
Applicable System Procedures
Use these system procedures to create and access Enscribe queue files:
• FILE_CREATE_, FILE_CREATELIST_, CREATE
• FILE_OPEN_, FILE_CLOSE_, AWAITIO[X], FILE_AWAITIO64_
• FILE_SETKEY_, FILE_SAVEPOSITION_, FILE_RESTOREPOSITION_, KEYPOSITION,
SAVEPOSITION, REPOSITION
• FILE_READ64_, FILE_READLOCK64_, FILE_READUPDATE64_, FILE_READUPDATELOCK64_,
READ[X], READLOCK[X], READUPDATE[X], READUPDATELOCK[X]
Enscribe Queue Files 107