Hi all,

Very quick testing on my home machine, (Win2K and Universe PE) suggests that if you pass the opened file pointer from the main to the cataloged routine it works as you would expect. If however, you do the file open within the subroutine it releases the lock when you return to the calling program.

--
Allen Egerton


Although most programmers think of the lock as being related to the file, it is actually related to a particular instance of opening the file via the associated file variable. The behaviour described by Allen above is what you should expect.

This is an essential feature of the language. If I open a file in a subroutine and either explicitly release all my locks using the variant of RELEASE with only a file variable or I simply close the file while I have locks in place, this should not (must not) affect other parts of my application that may have locks in the same file.

This all comes down to the programming theory concept of "encapsulation" where one part of an application should not need to know anything about what it happening elsewhere.

Note that if I copy the file variable, these are both references to the same file instance and locks are "shared" between the two file variables.


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

Reply via email to