DOS file locks (AREV Specific)
At 13 MAR 1998 11:06:57AM louis wrote:
Is there a way to lock a DOS file (in AREV Basic) before
using the OSOPEN/OSBREAD/OSWRITE type commands? We have
a DOS app that needs to read/delete shared files/records.
TIA
At 13 MAR 1998 02:08PM Victor Engel wrote:
Is there a way to lock a DOS file (in AREV Basic) before using the OSOPEN/OSBREAD/OSWRITE type commands? We have a DOS app that needs to read/delete shared files/records. TIA
OSOPEN opens the file with write access. Check STATUS() to see if another process already has the file open. The possible values for STATUS() are:
0 No error
1 Bad operating system filename
2 Access denied by operating system
4 File does not exist
5 Undefined error
If you still want to implement locking, you can. Just establish a standard that you will use. If you're using Netware, locks are handled by semaphores, so the file need not even exist. I'd suggest something like this:
OPEN 'DOS' to DOS_HANDLE THEN
LOCK DOS_HANDLE, OS_NAME THEN
Put your opens, reads, etc. here ; don't forget to unlockENDEND
Remember, DOS is an Arev file name with DOS filenames as its records.