Rafael Merino - GUI Computing
Your program keeps falling over during file i/o operation for no apparent reason, and the following message keeps appearing:
"MS-DOS File sharing lock-count exceeded. You need to increase the number of locks with share.exe".
First, remain calm. This is usually not to hard to fix.
During normal i/o processing data is locked and unlocked behind the scenes. However, during intensive data processing operations the normal background management of locking is unable to keep up, resulting in a buildup of locks.
If you are using the DOS file sharing, mechanism SHARE.EXE, then it means that you have reached the upper limit of the settings for file sharing. There are a number of strategies you can use to overcome this. If you are using the Windows Virtual Sharing mechanism, VSHARE.386, then you will not have this problem. However you may run out of virtual memory, in which case you need to use your Control Panel to increase it, or buy more RAM, or multi-task fewer programs.
The Strategies you can use to overcome this are listed below :
Note : Applications that run in DOS may require the SHARE.EXE, although they are becoming rare these days, in which case the above strategy is NOT recommended.
Use the FreeLocks command regularly in your code, particularly after using the Execute and Close methods. This strategy is recommended whether you are using the DOS or Windows file sharing mechanisms. FreeLocks suspends data processing, enabling the normal background processing of locks to occur, release locks on record pages, and make all data in your local Dynaset objects current.
Increase the Space Allocation and Number of Locks allowed with the SHARE.EXE program. These settings default to 2048 bytes for Space Allocation, and 20 file Locks. This really is not much to work with - so if you are using Windows the settings need to be increased to 4096 (or higher), for Space Allocation, and 500 File Locks. To change these settings modify the line in your AUTOEXEC.BAT file so that it looks something like the below.
"SHARE /F:4096 /L:500"