Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"File Already Exist" error when index

Status
Not open for further replies.

PieroF62

Programmer
Oct 20, 2007
7
IT
Hi,
my app run ok in many, many customers, but in one installation, when customer run a function that PACK files and after INDEX files (i use INDEX command not REINDEX) the process stop in one file and i see : error 7 - file already exist ?!?!?

The program are installed in a server and the customer use it in a client pc.

If i move the program in local the error not occurs.

The function is very simple : open DBF - PACK dbf - INDEX - close DBF

any idea ?
Thanks
Piero Ferasin
Alessandria (Italy)
 
while PACKing a table foxpro creates new files tremporarily, then deletes the old file and finally renames the new temp files. PACK does that for the DBF, REINDEX for the CDX, PACK MEMO for DBF and FPT file.

In that process a reason for the error you see could be missing priviliges. This is not the first time I hear about such a "hickup2 of VFP's PACK, especially when this is done on multiple files. Either VFP or the file system get out of sync. DOEVENTS FORCE (giving windows time to process any windows events including the filesystem) and SYS(1104) (manually triggering garbage collection of VFP) might help to stop that.

In fact it's not a good idea to PACK files on a file server from a client, as that involves network. Rather first copy tables locally, PACK them there and copy them back. Even though that means double reading and writing a file the local operations run undisturbed and so much faster then through the network, that you may even gain some performance overall.

Better yet let a program run on the fileserver itself to pack files, which spares the copying.

Bye, Olaf.
 
Hi Olaf,
thanks for reply.

About the thing that you write :
- the customer is administrator
- TEMP dir is setting in local c:\temp in the config.fpw
- i try with sys(1104) but not work

The strange is that procedure in other pc run OK.

The error is only in one PC.
The same app is installed in 20 customers, all in server machine in different city and only that non run OK.

About to COPY dbf in local pc, reindex and the re-copy in server, is not possible because dbf are large (at least 300-400 Mb each) and are too much (150-200 dbf)...

Last thing : this error in started 10-15 days ago.
Before all run OK (the apps is installed 8 years ago!)

Thanks
Piero, Ferasin
 
Your missing the point about copying. If you PACK a table, you already do copy the whole table back and forth, as the processing is on the client!! VFP is no server, there is no active component woorking on the server side, which handles the PACK sent to it, but a PACK means the client *is* reading the whole DBF to it removing deleted rows and saving it back to a temp file on the server, afterwards renaming that.

You actually already do what you want to prevent. And it may be a network weakness of that customer, which makes the PACKs fail.

The best solution would be a programm on the server side, where tables are local, that will PACK them there. That would be faster and more reliable.

Bye, Olaf.
 
Hi Olaf,

I have decided for your last solution :
"The best solution would be a programm on the server side, where tables are local, that will PACK them there. That would be faster and more reliable"

i will install a little procedure (in the pc server where are the tables) that PACK all tables when office is closed.

At this point i think that this is the best choise.
Thanks for help.
Piero
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top