Hi, I wrote this program which works okay on smaller tables, but the amount of time it takes gets exponentially longer the larger the table.
For instance, a table of 150,000 records takes about 6 minutes, a table of 550,000 records takes about 1 hour and a table of 3.5 million records takes over 1 day. Obviously, I am not doing something right here.
This is a table of price information. I am trying to populate the buybreak and sellbreak fields, which calculate the number of days since a previous low or high price has been realized. As an example, a file is attached with the proper results.
NOTE: the file in the ZIP file is a DBF file, even though it has the extension PNG. Foxpro will read it if you simply type in the extension, for example:
use file1.png in 0
alte tabl file1 add colu buybreak f(16,8)
alte tabl file1 add colu sellbreak f(16,8)
sele contract dist from file1 into curs contracts
sele date, contract, abshigh, abslow, recno() as rec from file1 wher contract=m.tempcontract orde by rec desc into curs breakout readwrit
alte tabl breakout add colu buybreak f(6,0)
alte tabl breakout add colu sellbreak f(6,0)
loca rest for abshigh>m.abshigh
repl all buybreak with m.temprecno2 for rec=m.temprec
loca rest for abslow<m.abslow
repl all sellbreak with m.temprecno3 for rec=m.temprec
upda file1 set file1.buybreak=breakout.buybreak, file1.sellbreak=breakout.sellbreak from breakout wher allt(file1.contract)=allt(breakout.contract) and file1.date=breakout.date
use in breakout