KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q202520: FILE: CDX(), TAG(), and SYS(14) Function to Create Index Utility

Article: Q202520
Product(s): Microsoft FoxPro
Version(s): MACINTOSH:3.0b; WINDOWS:3.0,3.0b,5.0,5.0a,6.0
Operating System(s): 
Keyword(s): kbDatabase kbHWMAC kbOSUNIX kbvfp kbvfp300b kbvfp500 kbvfp500a kbvfp600 kbXBase KbDBFDB
Last Modified: 01-DEC-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0 
- Microsoft Visual FoxPro for Macintosh, version 3.0b 
-------------------------------------------------------------------------------

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
  (http://download.microsoft.com/download/vfox60/samp17/1/WIN98/EN-US/GenTags.exe)

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

  Q119591 How to Obtain Microsoft Support Files from Online Services

Microsoft used the most current virus detection software available on the date of
posting to scan this file for viruses. Once posted, the file is housed on secure
servers that 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:

1. Place the GenTags.prg file in the same directory as the tables that have
  index files that you want to rebuild.

2. Run the program by typing the following in the Command window:

  DO GenTags.prg 

  This creates a program named Rebld.prg.

3. 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.

(c) Microsoft Corporation 1999, All Rights Reserved.
Contributions by John Desch, Microsoft Corporation


Additional query words:

======================================================================
Keywords          : kbDatabase kbHWMAC kbOSUNIX kbvfp kbvfp300b kbvfp500 kbvfp500a kbvfp600 kbXBase KbDBFDBC kbGrpDSFox kbDSupport 
Technology        : kbHWMAC kbOSMAC kbVFPsearch kbAudDeveloper kbVFP300bMac kbVFP300 kbVFP300b kbVFP500 kbVFP600 kbVFP500a
Version           : MACINTOSH:3.0b; WINDOWS:3.0,3.0b,5.0,5.0a,6.0
Issue type        : kbhowto

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.