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

198 AppendixA
COBOL Intrinsics
CKOPENSHR
CKOPENSHR
A call to CKOPENSHR initiates KSAM file processing with dynamic locking and shared
access allowed.
CALL "CKOPENSHR" USING
filetable, status
In order to process a KSAM file with shared access and dynamic locking, the file must be
opened with a call to CKOPENSHR. CKOPENSHR is exactly like CKOPEN in that it initiates
processing, specifies the type of processing, and specifies the access mode. The file must
have been created previously.
To open a file for shared access means to make it available for processing by more than one
user. Shared access allows all users to read or position the file, but only one user at a time
can modify the file by writing new records, or rewriting or deleting existing records. To
ensure that more than one user does not attempt to modify the file at the same time, you
must call CKLOCK to dynamically lock the file before calling the procedures CKWRITE,
CKREWRITE, or CKDELETE. After modifying the file, you should call CKUNLOCK so that it can
be accessed by other users.
Parameters
filetable
An 8 halfword record containing the name of the file, its input/output type,
and access mode. When the open is successful, the first halfword of this
table is set to the file number that identifies the opened file.
status
One halfword (two 8-bit characters) set to a pair of values upon completion
of the call to CKOPENSHR to indicate whether or not the file was
successfully opened and if not why not. The left character is set to 0 if the
open is successful, to 9 if not. The right character is to 0 if open is
successful, to the file system error code if not.
Operation Notes
A call to CKOPENSHR operates like the call to CKOPEN, except that CKOPENSHR allows shared
access and dynamic locking. Upon successful execution of CKOPENSHR, the file named in
filetable
is available for the type of processing specified in
filetable
. Before the file is
opened successfully, no operation can be performed that references the file either explicitly
or implicitly.
A file may be opened by CKOPENSHR for any of the access modes (sequential, random, or
dynamic) and for any input/output type (input only, output only, or input/output) allowed
with CKOPEN.
Refer to the description of using CKOPEN for the specific effects of opening a KSAM file with
the various input/output types and access modes.