>Hi Chris...
>
>As everyone has pointed out, these commands are rushmore optimizable. However, that isn't the real key to the speed. First off, the FOR operator will evaluate ALL records. Instead, it is much faster to use a combination of Seek and Locate.
>
>For example, lets say you wanted to loop through the records where state = "PA". Something like this would be much faster:
>
>Select customers
>If Seek("PA","customers","state")
> Scan While State = "PA"
> */ Do your stuff
> EndScan
>Endif
>
>The Locate For command is good to use when an index is not available. Given a large population of records, without an index, you really wont be able to speed things up....
>
Both are useful when you need some set of recors to be processed one at a time in the current order. LOCATE FOR's real playout is when you have some complex set of search requirements that are not in a single tag, but are all optimizable using the set of tags available for the table. SEEK works only if the filter condition matches the current tag expression. If taht's the case, SEEK and SCAN WHILE would seem to be a better tactic than LOCATE/CONTINUE.
If the sort order has nothing to do with eligibility of records, SEEK won't help. Neither will it help if several groups of records for the current tag order need to be examined.