Using KSAM/XL and KSAM 64 (32650-90886)

Appendix A 213
COBOL Intrinsics
CKUNLOCK
CKUNLOCK
A call to CKUNLOCK unlocks a KSAM file dynamically locked by CKLOCK.
CALL "CKUNLOCK" USING
filetable, status
A file locked by CKLOCK is released for use by other users with a call to CKUNLOCK. (If you
log off from any connection with the system, the file is also unlocked.) Since dynamic
locking takes place during shared access to the same file by more than one user, it is
important that any file locked by CKLOCK be unlocked as soon as possible by CKUNLOCK.
To use CKUNLOCK, the file must be opened for shared access with dynamic locking allowed.
This can be done only by calling CKOPENSHR to open the file, not CKOPEN.
Parameters
filetable
An 8 halfword record containing the number and name of the file, its
input/output type, access mode, and a code indicating whether the
previous operation was successful and if so, what it was.
status
One halfword (two 8-bit characters) set to a pair of values upon completion
of the call to CKUNLOCK. It indicates whether or not the file was
successfully unlocked and if not, why not. The
status
word is set to 00 if
the file was unlocked successfully; to 31 if the file was not locked; or to 9
n
where
n
is a binary file system error code if the call fails for any other
reason.
Operation Notes
After calling CKUNLOCK, you should always check the status parameter to make sure that
the procedure was executed successfully. When successful, the file locked by CKLOCK is
again made available for access by other users. If the file was not locked by CKLOCK, when
CKUNLOCK is called,
status
is set to 31.
The following example unlocks a file previously locked by CKLOCK. (Refer to the CKLOCK
example.)