Hi Bjorn,

This is how the language is defined to work.

A lock is, to some extent, associated with a particular opening of a file via its file variable. Closing the file either explicitly or as a result of discarding the file variable on leaving the subroutine will give away any locks taken against that file variable.

This behaviour is essential in some situations where one program calls another if the two programs have no knowledge of what each other does internally (which is good design).

Imagine a case where program 1 locks record A in some file. It then calls a subroutine which opens the file internally and locks records B and C. If this subroutine then did the form of RELEASE that takes only the file variable, it would release the locks on B and C but not on A. It would be very wrong for this operation to release A too.

On the other hand, as a general rule, you should try not to reopen files in subroutines unless you want this behaviour. You can get some massive performance benefits in some cases by opening files only once, using a common file variable. Opening a file is a very performance costly operation.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
+44-(0)1604-709200 -------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to