Enscribe Programmer's Guide
To read a record with the FILE_READUPDATELOCK64_/READUPDATELOCK[X] procedure, these
requirements must be met:
• An application must have write access to the file.
• The sync depth must be zero.
• The record must not be locked.
• The record must satisfy any key comparison rules defined by a prior call to the KEYPOSITION
procedure. (For more information about positioning, see Dequeuing With Positioning“Dequeuing
With Positioning” (page 114).)
The disk process skips over locked records until it reaches an unlocked record that satisfies the
record selection rules. The record selection rules are specified by the last invocation of
FILE_SETKEY_or KEYPOSITION. If the application does not call either of these procedures, the disk
process considers that all records in the file meet the selection rules. For more information, refer
to Dequeuing With Positioning“Dequeuing With Positioning” (page 114).
Records whose user keys are identical for the requested compare length are extracted according
to the timestamp generated at the time of insertion. The order of extraction may not be sequential
if locked records are encountered. Because each record is deleted after it is read, subsequent calls
to FILE_READUPDATELOCK64_/READUPDATELOCK[X] will reposition to the beginning of the
range of records which satisfies the selection rules.
The current primary-key value is not updated after the
FILE_READUPDATELOCK64_/READUPDATELOCK[X] operation.
Example
Figure 16 (page 112) shows how two processes might access a queue file. If process A attempts to
dequeue a record while the file is empty, the process waits until the file contains a record.
Figure 16 Dequeuing a Record
B ssecorPA ssecorP
READUPDATELOCK
Gets Record "1000"
File is Empty
(request queued)
Disk process returns record "1001"
READUPDATELOCK
WRITE:
Record "1001" inserted
The insertion of a new record causes the waiting Process A to be awakened and presented with
the new record.
Dequeuing From Audited Files
If the queue file is audited, the FILE_READUPDATELOCK64_/READUPDATELOCK[X] procedure
must be called from within a transaction. An application should commit the transaction only after
it processes the data it has extracted from the file, since the
112 Queue Files