Enscribe Programmer's Guide

Table 11 Locking Modes (continued)
FILE_READUPDATELOCK64_, READLOCK, and
READUPDATELOCK are treated as in normal mode.
FILE_READ64_, FILE_READUPDATE64_, READ and
READUPDATE requests ignore existing record and file locks;
Read-warn/reject mode
although an existing lock will not delay or prevent reading
the record, it causes a CCG completion with a warning
code of 9. FILE_LOCKFILE64_, FILE_LOCKREC64_,
LOCKFILE, LOCKREC, FILE_READLOCK64_,
FILE_READUPDATELOCK64_, READLOCK, and
READUPDATELOCK are treated as in reject mode.
You use SETMODE 4 procedure calls to enable the desired locking mode. The particular mode
that you select determines what action occurs if you try to lock a file, or read or lock a record,
when the file or record is already locked.
If you issue a CONTROL, FILE_CONTROL64_, FILE_WRITE64_ or WRITE request when the
referenced file or any record within it is already locked through a different file number or transid,
the request is always rejected immediately with an error 73 (file/record is locked) regardless of
which locking mode you have selected.
File Locking
NOTE: A call to FILE_LOCKFILE64_/LOCKFILE is not equivalent to locking all of the records in
the file; locking all records individually would still allow someone else to insert new records, whereas
file locking would not.
You use FILE_LOCKFILE64_, FILE_UNLOCKFILE64_, LOCKFILE and UNLOCKFILE calls to lock and
unlock Enscribe disk files.
If you call FILE_LOCKFILE64_/LOCKFILE when the specified file and all of the records within it are
unlocked (or all of the existing record locks belong to you), the lock is granted and your application
process continues execution.
If you call FILE_LOCKFILE64_/LOCKFILE when either the specified file or any record within it is
already locked through a different file number or transid, the action taken depends upon the locking
mode that is in effect at the time of the call.
When you close a file, all of the locks that you own against it are released immediately (except
in the case of audited files, where the unlocking is delayed until all your transactions have been
either committed or aborted and backed out).
NOTE: Frequent use of the FILE_LOCKFILE64_, FILE_UNLOCKFILE64_, LOCKFILE and UNLOCKFILE
requests on partitioned files should be avoided, as there is additional overhead to lock and unlock
every partition of the file. This overhead can be significant even for files with only 16 partitions.
HP recommends record level locking as a more efficient alternative with partitioned files.
Record Locking
Record locking operates in much the same manner as file locking, but it allows greater concurrent
access to a single file.
These procedures lock records within a file:
FILE_LOCKREC64_/LOCKREC locks the current record, as determined by the most recent
operation against the file.
FILE_READLOCK64_, FILE_READUPDATELOCK64_, READLOCK and READUPDATELOCK lock
the record to be read before reading it.
For audited files, FILE_WRITE64_/WRITE locks the record that is being inserted.
File Locking 151