Guardian Procedure Calls Reference Manual
LOCKREC Procedure
Summary
Syntax for C Programmers
Syntax for TAL Programmers
Parameters
Condition Code Settings
Considerations
OSS Considerations
Related Programming Manual
Summary
The LOCKREC procedure excludes other users from accessing a record at the current position. The
"user" is defined either as the opener of the file (identified by filenum) if the file is not audited—or
the transaction (identified by the TRANSID) if the file is audited.
NOTE: LOCKREC operations cannot be used with queue files.
For key-sequenced, relative, and entry-sequenced files, the current position is the record with a key
value that matches exactly the current key value. For unstructured files, the current position is the
relative byte address (RBA) identified by the current-record pointer.
If the record is unlocked when LOCKREC is called, the record becomes locked, and the caller
continues executing.
If the file is already locked by another user, behavior of the system is specified by the locking
mode. There are two "locking" modes available:
• Default—Process requesting lock is suspended (see Considerations).
• Alternate—Lock request is rejected with file-system error 73. When the alternate locking mode
is in effect, the process requesting the lock is not suspended (see Considerations).
NOTE: A call to LOCKFILE is not equivalent to locking all records in a file; that is, locking all
records still allows insertion of new records, but file locking does not. File locks and record locks
are queued in the order they are issued.
The LOCKREC procedure performs the same operation as the FILE_LOCKREC64_ Procedure
(page 453), which is recommended for new code.
Key differences in FILE_LOCKREC64_ are:
• The tag parameter is 64 bits wide.
• The procedure returns an error code value rather than a condition code, simplifying
error-handling code.
Syntax for C Programmers
#include <cextdecs(LOCKREC)>
_cc_status LOCKREC ( short filenum
,[ __int32_t tag ] );
LOCKREC Procedure 775