Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why SCAN does not EXIT?
Message
From
15/08/2002 10:41:08
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, California, United States
 
 
To
14/08/2002 22:19:46
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00689830
Message ID:
00689987
Views:
16
Ulises,
One question... how do you know it's reached the "last" match? Have you stepped through it or set a breakpoint when RECNO() = RECCOUNT()?

You might also try this:
LOCAL xCount, lcFile, lcCRLF

SELECT Table1
xCount = 0
lcFile = 'CheckOwe'
lcCRLF = CHR(10) + CHR(13)

STRTOFILE('Look for the first duplicate record # in this file:' + ;
   lcCRLF, lcFile, .F.)


SCAN FOR OWE <> 0

   STRTOFILE(TRANSFORM(RECNO()) + lcCRLF, lcFile, .T.)

   SELECT Table2
   LOCATE FOR IDStd = Table1.IDStd

   REPLACE Owe WITH Table1.Owe

   xCount = xCount + 1
ENDSCAN
Let this run for awhile until you're sure that it's chasing its tail, and then check out the file ('CheckOwe').

You'll end up with a list of record #s from Table1, in order of how they were being processed. Where the duplicates begin is where the trouble started.

Good Luck,
---J

>Hi all.
>I have a few lines of code like this:
>SELECT TABLE1
>GO TOP
>xCOUNT=0
>SCAN FOR OWE <> 0
>STORE idSTD TO xidSTD
>SELECT TABLE2
>LOCATE FOR idSTD=xidSTD
>REPLACE OWE WITH TABLE1.OWE
>xCOUNT=xCOUNT+1
>LOOP
>EXIT
>ENDSCAN
>
>Problem is it keeps going into an endless loop, without exiting when the last match is found. What am I missing?
>
>TIA
>Ulises
Previous
Reply
Map
View

Click here to load this message in the networking platform