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

Rebuilding indexes in Foxpro v2.6 in an executable

Status
Not open for further replies.

nbeni

MIS
Joined
Nov 15, 2002
Messages
1
Location
US
Hello:

I have a user who has an application written in Foxpro v2.6. I would like to be able to re-build all the indexes for him;however, he doesn't have the source code. The application is an executable intead. If I could only find out what tables are using indexes, I could at least re-build the indexes for him to see if that is causing a problem. The response has been very slow lately among other problems.


Thanks in advance!

nbeni
 
If you can get copies of the files, it's not hard to document the indexes, and create a separate Re-Indexer program. If you are "good" with a Hex file viewer, it's even possible to pull this information out of the headers of the .IDX / .CDX files.

Rick
 
"I would like to be able to re-build all the indexes for him"

If the tables are not corrupted and you have a Foxpro development environment, you can sequentially Open the tables and then, with the View Window, you can examine (write down) the expressions for the existing indicies.

Or you could use the TAG() and KEY() commands to sequence through the table's indicies and copy them off to another file which can then be used for re-indexing.

Lastly, and a more long lasting solution, would be to use Re-Fox (from ) to de-compile the EXE program. From that you could examine the PRG's which make up the EXE.

Not only could you:
1. Examine how the indicies are used and determine
the expressions.
2. Create your own re-index program and add it as a
new Utility to the EXE program.

But you could also examine the program to see if there were other programmatic issues which were affecting the speed of execution.

If you need any other additional support, please feel free to contact me.

Good Luck,
JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
You could even automate the whole thing with Dennis Allen's DW4
QUOTE
Data Wire Four v01.08.02
The Data-Wire Four is a Foxpro procedure designed to allow an application to verify databases quickly and easily.
In essence, the programmer executes DW4, generating a data dictionary program. When executed, this program verifies that all specified databases exist and have the correct field layouts. Structural indices are verified. Both Foxpro 2.6 and Visual Foxpro DBF formats are maintained. <ASP> approved.
Data Wire Four will now repair invalid/missing memo files. To repair a corrupted memo file, DW4 will first repair the memo file header. A new DBF file is then created and original data appended. While this process cannot guarantee full memo data recovery, at least the DBF file should be good.
END QUOTE
I found it, via a sugestion on this forum, at....
 
It create a file of your dbf indexes,

Port that data to sysindex .dbf

to populate the sysindex.dbf with cdx info the first times , try

If you wish to automate your indexing , try
David W. Grewe
Dave@internationalbid.com
 
*********************************************************************
*
* Program : indexall
* Purpose : To rebuild all database indices
*
* Author : Carl Crewe
*
*********************************************************************

PRIVATE m.count, N, m.choice, m.key, subdir, fromdir, mlimit, mpath
PRIVATE mname


SET DEFAULT TO SYS(5) + SYS(2003)
SET PATH TO SYS(5) + SYS(2003)
SET TALK OFF
SET DELETED OFF

SET PROCEDURE TO procfile
subdir = '\dbfs\'

fromdir = sys(5) + sys(2003) + subdir
mpath = fromdir + '*.dbf'

CLEAR
TEXT

This utility will re-index all the database files. Use it
where index corruption is suspected.

ALL OTHER USERS MUST BE OFF THE SYSTEM

The utility may take several minutes to complete.

Proceed with utility (Y/N)?
ENDTEXT

DO WHILE .t.
m.key = INKEY(0)
DO CASE
CASE INLIST(m.key, 89, 121) && Y or y
EXIT
CASE INLIST(m.key, 78, 110) && N or n
CLEAR
RETURN
ENDCASE
ENDDO
CLEAR

CLOSE DATABASES
SET EXCLUSIVE ON
ON ERROR DO cleanexit WITH PROGRAM(), LINENO()

N=1
mlimit = ADIR(list,mpath)

=ASORT(list,1)

FOR N = 1 TO mlimit
mname = List(N,1)
DO Message WITH 'About to open Database', '', mname

=loaddbf(mname) && opens the dbf file

DO Message WITH 'Re-indexing Database', '', mname
REINDEX
USE
ENDFOR

RELEASE WINDOW message

RETURN


You can set this up as an exe file and run it in the directory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top