HPlogo Using KSAM XL: 900 Series HP 3000 Computer Systems > Chapter 9 KSAM XL Intrinsics

FLOCK

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Dynamically locks a file. A call to FLOCK is required before any attempt is made to read or modify a file with shared access.

NOTE: The file system does not guarantee exclusive access, even when FLOCK and FUNLOCK are used, unless all programs that access the file cooperate by using locking. A program that opens the file with dynamic locking enabled will still be allowed to modify the file, even if it never calls FLOCK.

Syntax

         I16V  U16V

   FLOCK(filenum,lockflag);

Parameters

filenum

16-bit signed integer by value (required)

Passes the file number of the file whose global resource identification number (RIN) is to be locked.

lockflag

16-bit unsigned integer by value (required)

Specify either conditional or unconditional locking by setting bit (15:1) as follows:

Value

Meaning

0

Locking takes place only if the file's global RIN is not currently locked. If the RIN is locked, control returns immediately to the calling process, with condition code CCG.

1

Locking takes place unconditionally. If the file cannot be locked immediately, the calling process suspends until the file can be locked.

Condition Codes

The following condition codes are possible when lockflag bit (15:1)=1:

CCE

Request granted.

CCG

Not returned.

CCL

Request denied. This file was not opened with the dynamic locking aoption bit (10:1) specified in the FOPEN/HPFOPEN intrinsic.

The following condition codes are possible when lockflag bit (15:1)=0:

CCE

Request granted.

CCG

Request denied because the file was locked by another process.

CCL

Request denied. This file was not opened with the dynamic locking aoption bit (10:1) specified in the FOPEN/HPFOPEN intrinsic.

Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual (32650-90028) for other codes pertaining to KSAM files.

Feedback to webmaster