>I need to run a PACK command on a .dbf file in a program called from
>Visual Basic (multilink) under a multiuser environment. But, PACK requires
>the file to be packed to set to exclusive use only. That means that all
>users on the network will need to logout in order to prevent anyone from
>accessing the file while packing and that that .dbf file is closed.
First a question: why do you need to PACK on a network when other people are
using the files? Could you not time this event to happen when you CAN get
exclusive use of the files?
And now for the comment: If you think about the logistics of this, I think
you can see that it MUST have an exclusive use to prevent corrupting
pointers within the index files in use for OTHER people using the data. The
concept of packing is to remove records which are marked, but not actually
deleted, and recover the disk space, right? Well, if I understand things
correctly, the index files still contain pointers to the marked records,
which is why "unmarking" the record restores it to its previous status in
the correct index order. Consider: if a person is currently using the DBF
and you blast away and pack it. The next reference to the now changed DBF
and INDEX cause different data to be retrieved because the innocent user has
no way of knowing the files were modified by another application and still
has the old pointers in memory. By requiring exclusive use, PACK ensures
that no pointers are going astray for anyone else. Brute force, but
effective, and also restrictive as you found out.
Now a suggestion: implement a "record recycling" scheme into the programs
that access the data. This means, that instead of appending a blank record
every time, you first check and see if you have a record that is marked to
recycle and use that one instead of increasing the size of your DBF. The
only time a new record is appended is if there are no more that are marked
for recycle. This can be as simple as a logical flag in the DBF or as
complicated as a separate procedure you run now and then which "expires"
records based on a date or some such and marks them for recycling. Recycling
can be as easy or as hard as you want to make it. Modifying programs to do
it may or may not be easy. THAT depends on who wrote the program and the
techniques they used to deal with the data.
... and NO, I speak for no one else but me, myself and I, of course.
(I recycle glass, newspapers and DBF records for food.)