Microsoft KB Archive/202520

= FILE: Use CDX,TAG, and SYS(14) Function to Create an Index Utility =

Article ID: 202520

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q202520



SUMMARY
GenTags.exe is a sample file that contains a FoxPro program which creates another FoxPro program that you can then run to rebuild index files for FoxPro tables.



MORE INFORMATION
The following files are available for download from the Microsoft Download Center:

GenTags.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. Power failures, system crashes, network issues, and user actions occasionally result in corrupted indexes. Corrupt indexes, in turn, are a frequent cause of General Protection Faults and Invalid Page Faults. Issuing a REINDEX command does not resolve the issues associated with a corrupt index. Consequently, a plan for regular index maintenance, involving deletion and re-creation of index tags, is an essential aspect of application design and development.

Under FoxPro 2.6, index corruption issues are relatively easily resolved by deleting and re-creating the IDX/CDX files. Visual FoxPro brought the addition of Primary Keys, Candidate Keys, Foreign Keys, and Persistent Relationships. The addition of those features and more robust Referential Integrity functions has made the process of maintaining indexes considerably more complicated.

With Visual FoxPro, one option for re-creating corrupt indexes is to use GenDBC.prg to re-create the database structure and indexes, and then restore the data back to each table. Another option is to use the sample file GenTags.prg to create a program file to perform index maintenance tasks.

To use the GenTags.prg file:  Place the GenTags.prg file in the same directory as the tables that have index files that you want to rebuild.  Run the program by typing the following in the Command window: DO GenTags.prg This creates a program named Rebld.prg.   To re-create the index files for the tables, type the following in the Command window: DO Rebld.prg You can use the Rebld.prg file again whenever the indexes for the tables need to be rebuilt. Be sure to run GenTags.prg again to re-create the Rebld.prg if the indexes are modified. 

WARNING: Running the code generated by GenTags.prg with a Visual FoxPro database containing Referential Integrity (RI) code generated by the RI Builder, results in loss of those RI functions.

Keywords: kbhowto kbdownload kbxbase kbdatabase KB202520

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.