wadesnj
Programmer
- Mar 24, 2001
- 36
- 0
- 0
I have a 40,000 record Foxpro 2.6 table. It has 244 fields and is 67Mb in size. I want to selectively clear the values in about 200 fields in 2000 records conditional on a date range. My code at present looks like this:
goto mStartrec && The first matching line is already located.
DO WHILE Invlines.Date <= Menddate and not eof()
FOR x=32 to 242
IF x <> 33 AND x <> 193 && Do not clear field 33 or 193
If Type(FIELD(x))="C"
REPLACE (FIELD(x)) WITH ""
Endif
If Type(FIELD(x))="N"
REPLACE (FIELD(x)) WITH 0
Endif
Endif && of not fields 33 or 193
Endfor
mcount=mcount+1
Mper=(Mcount/Maxrecs)*100
=PROGRESS(Mper,'Clearing values for matching record '+allt(str(mcount)))
SKIP
ENDDO
The table is indexed on the DATE field. The routine is very slow (5 minutes plus), and it is only acting on a small number of records.
Is there a better way to do it?
goto mStartrec && The first matching line is already located.
DO WHILE Invlines.Date <= Menddate and not eof()
FOR x=32 to 242
IF x <> 33 AND x <> 193 && Do not clear field 33 or 193
If Type(FIELD(x))="C"
REPLACE (FIELD(x)) WITH ""
Endif
If Type(FIELD(x))="N"
REPLACE (FIELD(x)) WITH 0
Endif
Endif && of not fields 33 or 193
Endfor
mcount=mcount+1
Mper=(Mcount/Maxrecs)*100
=PROGRESS(Mper,'Clearing values for matching record '+allt(str(mcount)))
SKIP
ENDDO
The table is indexed on the DATE field. The routine is very slow (5 minutes plus), and it is only acting on a small number of records.
Is there a better way to do it?