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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table-Index Integrity 2

Status
Not open for further replies.

christotan

Programmer
Mar 15, 2000
6
US
I have recently created a program that handles some 30 different free tables. It has been working fine 99% of the time.<br><br>However, sometimes one (no specific one) of the tables (during initialization) will give me an error : &quot;Index does not match table&quot;. Now, I know how to rectify the situation, but I will be compiling it into an EXE file and will soon no longer be able to be there to rectify it. I cannot find any cause of the problem in my code.<br><br>Is there anyway to test the integrity of the table-index and rectify if there is a need to BEFORE the &quot;USE &lt;tablename&gt; IN &lt;wrkarea&gt;&quot; command is used? Thanks.
 
I maintain a system that was converted from 2.6 into Visual and has over 300 free tables and no databases.&nbsp;&nbsp;I never get that error unless one of the file server(s) is rebooted on me with the tables open.&nbsp;&nbsp;<br><br>Anyway, I have a Nightly maintenance routine that checks the indexs on all tables every night and then reindexes them if any error is reported.&nbsp;&nbsp;Maybe you can use some variation of it check your table BEFORE you USE it.<br><br>Works like this<br><br>close all<br>on error do errortrap<br>use sysindex&nbsp;&nbsp;&nbsp;&& a tables with one record for every database in the system with the indexs in a memo field.<br>scan all<br>&nbsp;&nbsp;gnerror =0&nbsp;&nbsp;<br>&nbsp;&nbsp;lcDbf = alltrim(sysindex.drive) + alltrim(sysindex.directory) + alltrim(sysindex.database)<br>&nbsp;&nbsp;select 0<br>&nbsp;&nbsp;use (lcDbf) exclu<br>&nbsp;&nbsp;if gnerror &gt; 0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.....&nbsp;&nbsp;&nbsp;&& code to recreate the index as stored in the sysindex.cdx memo field<br>&nbsp;&nbsp;endif<br>&nbsp;&nbsp;use<br>&nbsp;&nbsp;select sysindex<br>endscan<br>&nbsp;&nbsp;<br>procedure errortrap<br>gnerror = 1<br>return<br><br>If you (or any one else that reads this) wants the entire source code to make you own nightly reindex routine let me know and I will email it to you.&nbsp;&nbsp;<br>P.S. it all so creates backups of all dbf's, cdx's and fpt's it plays with incase something goes wrong.<br>P.S.S.&nbsp;&nbsp;I have a routine that collects the index information from a table also if you want that also. (just incase you do not want to write down all the indexs on every table).<br><br><br> <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
Ok, Ok, Stop Emailing Me,<br>I got so many requests for this I put it on my FTP server.<br>If you want it go download it.<br>ftpserver&nbsp;&nbsp;=&nbsp;&nbsp;ibs.internationabid.net<br>username = guest <br>password = freebe<br>Password will expire 6/1/2000<br><br>I put the files in a folder called &quot;sysindex files&quot;<br>there are 5 files<br>cdxstru.prg<br>sysindex.prg<br>sysindex.dbf<br>sysindex.fpt<br>sysindex.doc&nbsp;&nbsp;&& wordpad document on how to use it.<br><br>Please do not abuse the server or I'll stop access to it.<br>if you read this after 6/1/2000 and want the files Email me.<br> <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
It was brought to my attention that cdxstru.prg does not document candidate /&nbsp;&nbsp;primary indexes.<br>Sorry, Somehow that file was&nbsp;&nbsp;overlooked when I update all my library files from FPW to VFP.&nbsp;&nbsp;<br>The corrected version dated 4/25/2000 is now on the FTP server.<br> <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top