Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why SCAN does not EXIT?
Message
De
15/08/2002 10:41:08
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
 
 
À
14/08/2002 22:19:46
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00689830
Message ID:
00689987
Vues:
17
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform