Groups > dBase > dBase support > File Locking Information




File Locking Information

File Locking Information
Tue, 18 Dec 2007 12:47:26 -050
As per Ivar's suggestion, here is a quick recap...

Scenario:
We have a dBASE program that will lock files and when another user tries to
access the file we have an error routine that will return the error number and
message. In our case, 108 File in use by another. We were trying to find out who
has the file locked.

Goal:
To know who has the file locked or exclusively with the least code/modification
as possible.

Language:
dBASE 5.0 for DOS

Current Ideas:
(Thanks to Geoff, Marilyn and Greg from the board.)

-> Only USE tables EXCLUSIVE when absolutely needed.
-> Use the LIST USERS command at the time of error to have a list of
culprits.
-> Using semaphores to control file access.

Previous ideas:
-> LKSYS()
--> So far, I can only return information from LKSYS(3), LKSYS(4) and
LKSYS(5) Which is the information of the last lock. LKSYS(0), LKSYS(1) and
LKSYS(2) return information from the buffer, but I could not get it to return a
value. As Marilyn stated, "If I remember correctly, lksys() is only used if
the file has been rlock()ed or flock()ed. Opening it exclusive does not write
out this information, so it won't do you any good to go looking for it any
way..."

-> Using a Global variable tracking.
--> Could get complicated quickly because of the amount of variables and
clearing the variables upon expected program termination.

-> Use another language to access the field in the locked file.
--> So far my research hasn't shown this to be easy, if even possible.

Current Question(s) / Confusion(s):
-> When our program is run without a user defined error routine and
encounters an error, something in dBASE shows the entire line it couldn't
process. Can we capture that line somehow for use in runtime?

-> Also when a program errors sometimes dBASE shows a more detailed error.
The output seems to be sent to the screen behind the command window. Can we
capture that somehow for use in runtime?

Post Reply
about | contact