×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Table-Index Integrity
2

Table-Index Integrity

Table-Index Integrity

(OP)
I have recently created a program that handles some 30 different free tables. It has been working fine 99% of the time.

However, sometimes one (no specific one) of the tables (during initialization) will give me an error : "Index does not match table". 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.

Is there anyway to test the integrity of the table-index and rectify if there is a need to BEFORE the "USE <tablename> IN <wrkarea>" command is used? Thanks.

RE: Table-Index Integrity

2
I maintain a system that was converted from 2.6 into Visual and has over 300 free tables and no databases.  I never get that error unless one of the file server(s) is rebooted on me with the tables open.  

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.  Maybe you can use some variation of it check your table BEFORE you USE it.

Works like this

close all
on error do errortrap
use sysindex   && a tables with one record for every database in the system with the indexs in a memo field.
scan all
  gnerror =0  
  lcDbf = alltrim(sysindex.drive) + alltrim(sysindex.directory) + alltrim(sysindex.database)
  select 0
  use (lcDbf) exclu
  if gnerror > 0
     .....   && code to recreate the index as stored in the sysindex.cdx memo field
  endif
  use
  select sysindex
endscan
  
procedure errortrap
gnerror = 1
return

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.  
P.S. it all so creates backups of all dbf's, cdx's and fpt's it plays with incase something goes wrong.
P.S.S.  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).


David W. Grewe
Dave@internationalbid.net

RE: Table-Index Integrity

Ok, Ok, Stop Emailing Me,
I got so many requests for this I put it on my FTP server.
If you want it go download it.
ftpserver  =  ibs.internationabid.net
username = guest
password = freebe
Password will expire 6/1/2000

I put the files in a folder called "sysindex files"
there are 5 files
cdxstru.prg
sysindex.prg
sysindex.dbf
sysindex.fpt
sysindex.doc  && wordpad document on how to use it.

Please do not abuse the server or I'll stop access to it.
if you read this after 6/1/2000 and want the files Email me.

David W. Grewe
Dave@internationalbid.net

RE: Table-Index Integrity

It was brought to my attention that cdxstru.prg does not document candidate /  primary indexes.
Sorry, Somehow that file was  overlooked when I update all my library files from FPW to VFP.  
The corrected version dated 4/25/2000 is now on the FTP server.

David W. Grewe
Dave@internationalbid.net

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close