Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Simon Arnold
  Where is Simon Arnold?
 Halifax
 United Kingdom
 Simon Arnold
 Tags
Subject: Speed Issue
Thread ID: 641 Message ID: 641 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Friday, June 08, 2001 6:44:37 AM         
   


I have a small procedure that goes through a table that contains 264 records, these records hold the name of a Prg file, what the program needs to do is to work through all 264 records, and see if the any of the .prg files contains a SET PROCEDURE TO progfile and then report.

Note the form opens a table called ProgramFiles twice.
One Alias = ProgFiles and the Other is ProgFiles2, this is done because you need to obtain the
Key from the record you are currently on, then re-search the same file if a SET PROC has been found, for the key of the program containing this.

Code as follows - takes about 1hour + to run, any ideas on how to increase the speed would be helpful.

=ADIR(laFiles,"P:\PATH\*.PRG")

SELECT ProgFiles
SCAN FOR ProgFiles.Status = "LIVE"
lcS1 = "SET PROCEDURE TO " + ALLTRIM(ProgFiles.ProgName)
lcS2 = "SET PROC TO " + ALLTRIM(ProgFiles.ProgName)
FOR lnI = 1 TO ALEN(laFiles,1)
lcCheck = FILETOSTR(laFiles[lnI,1])
IF lcS1 $ UPPER(lcCheck) OR lcS2 $ UPPER(lcCheck)
SELECT ProgFiles2
lcFind = ALLTRIM(UPPER(STRTRAN(laFiles[lnI,1],".PRG",""))) = ALLTRIM(ProgFiles.ProgName)
IF SEEK(lcFind,"ProgFiles2","ProgName")
SELECT ProgLink
LOCATE FOR ProgLink.Prog1 = ProgFiles2.ProgKey AND ProgLink.Prog2 = ProgFiles.ProgKey
IF !FOUND()
INSERT INTO ProgLink VALUES (ProgFiles2.ProgKey,ProgFiles.ProgKey)
ENDIF
ENDIF
ENDIF
ENDFOR
SELECT ProgFiles
ENDSCAN

Please note I did not originally write this code, I am trying to speed it up, I have tried to use the Filer.dll to return just the files with the matching code, then loop through the results, but this is turning out to be even slower.

Any help is appreciated.

Thanks.
Simon Arnold
Westlake Computer Systems Ltd.
Halifax, UK.
simon.arnold@foxite.com

ENTIRE THREAD

Speed Issue Posted by Simon Arnold @ 6/8/2001 6:44:37 AM
RE: Speed Issue Posted by Thomas Holt @ 6/8/2001 7:01:01 AM
RE: Speed Issue Posted by Eric den Doop @ 6/8/2001 7:41:44 AM
RE: Speed Issue Posted by Simon Arnold @ 6/8/2001 7:59:47 AM
RE: Speed Issue Posted by Paul Brown @ 6/8/2001 7:53:08 AM