Skip to main content

When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

Hi Rolf,

The only information returned from the file handler is the status code information that the record or file is locked not who is actually holding the lock.

On Server Express there is a utility called wholock that can be run against the file which will report the process ID of the processes that currently hold a lock on a particular file. It might be possible to run this from within COBOL and then read its output to obtain this type of information but this is not something I have ever tried.

There are configuration file settings that can be used to alter the way this locking is done to allow your application to ignore locks or read past them, etc.

I would suggest looking at options, IGNORELOCK, SKIPLOCK and RETRYLOCK under the File Handling Configuration option section of the documentation.


When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

Hi Chris,

I am using Net Express 5.1 with Windows 7 64-bit. I can't find this utility Wholock. I have looked to the runtime directory and also to the directory C:\\Program Files (x86)\\Micro Focus from the Net Express installation.

I thank you for your troubles.

When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

The wholock utility is only available on Unix/Linux systems with Server Express and Visual COBOL. It is not available on Windows with Net Express.

There are some 3rd party tools that will let you monitor file locks under Windows such as WhoLockMe and Process Monitor.

Thanks

When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

The solution is "file get-locks filename" in fsview.exe with NetExpress 5.1.14. You must also use Fileshare Security (call "fhrdrpwd"), to identify your processes.
Thanks

When I try to read a record, that is locked by another user, I receive the status code 9-68  or 9 65.  Is there any possibility from within the Cobol program to know besides this Status, the name of the user, or computer who holds the lock?  That would be very helpful for the person that is waiting until the record is released.

Thanks for any help

Rolf

The FSVIEW commands are only applicable when using Fileshare to control access to your files. This approach will not work for files that are opened and shared by different processes or users running outside of Fileshare.