>Suhas
>
>I tried all of your code on a file I keep around for testing. It has 5.25 Million records. Your first code took 102.553 seconds. The second took 107.589 and the third took 104.452.
>
>Try this instead:
>
>Clear all set relations etc.
>
>Build this tag, once and plan to reuse it.
>
>INDEX ON SYMBOL + ',' + DTOS(DATE) TAG SYDT
>
>Then see if this is fast enough:
>
>
Select bhav_data
>set order to tag sydt
>scan
> m.lcsy = symbol + ','
> copy to array aopen while symbol + ',' = m.lcsy
>endscan
>
>
>It took 30.149 seconds on my file ;)
One trouble with copy-while inside a scan/endscan loop is that you'll miss the first record of every symbol value except the first, because after copy-while you land of the first record for which the while condition returns .f., and then endscan does one more skip. Compare the lengths of arrays you get your way against what you get like this
Select bhav_data
set order to tag sydt
locate
do while not eof()
m.lcsy = symbol + ','
copy to array aopen while symbol + ',' = m.lcsy
enddo
and then see whether the total length of arrays matches reccount().
Of course, the other trouble is that even so, nothing is done with the array inside the loop, so we're doing all of this for nothing, except for the last value of bhav_data.symbol :).