Syntax: LOCK (lun) [,EXCP=statement-label | NOEXCP]
Discussion: The LOCK statement locks a logical unit number. It is a way to prevent a specified file from being opened by another user.
The lun parameter is a numeric or symbolic constant that is previously assigned to a file by an OPEN statement -- it represents the logical unit to be locked.
If th LOCK statement is attempted while another user has the particular file open, an exception 7 (FILE UNAVAILABLE -- LOCK/UNLOCK ERROR) will be encountered.
Example: OPEN (1) "FILEB"
Posted by Jim Guerber on August 25, 2008 at 18:16:31:
In Reply to: Re: LOCK question posted by Grant Foraker on August 25, 2008 at 14:33:51:
We will try to turn this "feature" off. Here is what I found.
When a program locks a file, the same partition may open the same file on multiple LUNS without a problem.
If a program running in another partition tries to open the file, it will get a lock violation.
If a program wishes to unlock a file and not close it, it can issue an unlock through the unlock(LUN) statement.(The unlock may be issued from ANY LUN that has the file opened.)
The lock flag was getting reset when ANY LUN on the owning partition was closed. This happens whether the close happens in an enter program or not. This was probably incorrect.
We will make the lock persistent such that the only way to unlock a file is to either issue an unlock or close the file on the last LUN which has it open.
Does that make sense to everyone?
If you all agree, the change will be made in the next file server release.