>Hi everybody,
>
>Spent ~ 10 minutes (or more) trying to figure out this simple thing.
>
>I have this in my code:
>>select c_Profiles
>scan while empty(m.lcError)
>...
>
>
>Couple of lines of code above I did a SUM on this file (I guess, I better do a select sum(..) then). And therefore I was at the bottom of the file. I used to the fact that SCAN goes top automatically and haven't realised that WHILE scope changes it.
>
>Well, at least I figured this one out :)
>
>Thanks.SCAN and SCAN FOR start at the top. SCAN WHILE starts at the current location. All leave the file pointer at the last record seen if you exit the loop or at EOF() if the SCAN..ENDSCAN was run for the whole file.
If you do something inside the loop that moves the pointer -like SUM() in your example-, then SCAN gets screwed up.
HTH