I have a corrupt mdx file that refuses to get reindexed. I deleted it, created a new one, and I still get the same error whenever I try to reindex or pack: "File already open." Any suggestion for a fix will be grately appreciated. Thx.
If on a network or accessing remotely, do you have the file permissions to both read and write? (Will it reindex locally but not on the server?) Sounds silly to ask, but in some other programming languages that message has been a rights issue.
Is the table opened exclusively?
Are you sure all the data in the table's fields that get indexed are valid? If there are non-ASCII charaters in the indexed fields such as any character values below 32, this can mess up indexes. Especially troublesome are the nulls, CHR(0).
Okay, lets walk through the replacement of indexes in the MDX:
USE <tablename> EXCLUSIVE
Repeat this step until all TAGs are removed/deleted:
DELETE TAG TAG(1)
Now, the MDX should no longer exist. For good measure, lets USE he table all over again
USE <tablename> EXCLUSIVE
Now recreate each index, as many as needed:
INDEX ON <fields> TAG <indexname>
Did it work? If not, then try copying the records to a new table, perhaps something is scambled in the original table:
USE <tablename> EXCLUSIVE
SET DELETED OFF && do this to preserve any deleted records
COPY TO <newtable> WITH PRODUCTION && new table/indexes
Thx, dbmark. Rebuilding the mdx didn't do the trick, so I'm guessing the problem is some rogue character in the table, as you proposed. The problem is, there are over 8,000 records, and I don't know how to go about looking for that character. It's been over ten years since I was a dBASE programmer (this is part of a program that I wrote in 86 and the client hasn't updated since then...)
I'd appreciate any other suggestion you might have.
Hi, dbmark. I neglected to mention in my first posting that this app is written in dBASE IV. I don't remember (I wrote that app in the early 90s) whether this version of dBASE supports UDFs, but I'm pretty sure it doesn't. It's been years since I did any work in dBASE.
I have had this error in the past and think it is likely to be the speed of the Pc that is the issue. IIRC dBase uses the clock speed to assign temporary file names and if th clock ticks over too quickly then these become corrupt.
You need to slow your PC down, I did find a utility called IDXFIX that I used successfully for this.
I have had this problem on occasion. The only fix I found was to open the table, and copy the structure, go to the new table, append all records, delete the original table, and copy the new table back to the old tables name.
use TblName name
Copy stru with production to temp
use temp
append from table
copy with production to TblName
This keeps all the indexes intact. Reduces the work in fixing it. Hope it helps.
I will go with blorf's suggestion except that not to copy back to the original file yet.
create some indexes and see if it works. Then copy to the same file.
Tryit.
use filcat
copy structure to filcats
use filcats
index on filnavn tag fildex * empty database, no-error
append from filcat *UPDATE MASTERINDEX NO-ERROR
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.