HPlogo KSAM/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 USING KSAM FILES IN COBOL PROGRAMS

CKOPENSHR

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

A call to CKOPENSHR initiates 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 with the BUILD command of program KSAMUTIL (refer to section II).

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 insure 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-word record containing the name of the file, its input-output type, and access mode. When the open is successful, the first word of this table is set to the file number that identifies the opened file. (Refer to Filetable Parameter discussion earlier in this section.)

status

one word (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. Left character is set to "0" if open is successful, to "9" if not. Right character is to"0" if open is successful, to file system error code if not. (Refer to Status Parameter discussion earlier in this section.)

USING CKOPENSHR

Except that CKOPENSHR allows shared access and dynamic locking, and CKOPEN does not, a call to CKOPENSHR operates exactly like the call to CKOPEN. Upon successful execution of CKOPENSHR, the file named in filetable is available for the type of processing specified in file- table. 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 affects of opening a KSAM file with the various input-output types and access modes.

Feedback to webmaster