Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?



This function is used to ascertain the status of a record lock. It takes the general form: 

RECORDLOCKED(filevar, recordkey)


filevar is a file variable from a previously executed OPEN statement.

recordkey is an expression for the record id that will be checked.

The function returns an integer value to indicate the record lock status of the specified record id.

Locked by this process by a FILELOCK
Locked by this process by a READU
Locked by this process by a READL
Not locked
Locked by another process by a READL
Locked by another process by a READU
Locked by another process by a FILELOCK

If the return value is negative, then the SYSTEM(43) and STATUS function calls can be used to determine the port number of the program that holds the lock. If -1 is returned, more than 1 port could hold the lock and so the port number returned will be the first port number found. 

An example of use is as: 

OPEN "records" TO FILE_VAR ELSE ABORT "Cannot open records"
    CRT "Record not locked"


OPEN "INVENTORY" TO invFvar ELSE ABORT 201,"Cannot open the INVENTORY file"
IF RECORDLOCKED (invFvar,invId) = -2 THEN
    CRT "Inventory record ":invId:" is locked by port ":SYSTEM(43)

Go back to jBASE BASIC.

Was this article helpful?