Spitballing off the top of my head here, and I'm assuming there is no index anywhere close to this, have you tried adding an index on alltrim(str(rx_no)) + alltrim(str(refill_no))? Then your Delete statement becomes
Delete From rx_claim ;
Where (ALLTRIM(STR(rx_claim.rx_no) + ALLTRIM(STR(rx_claim.refill_no)) = ;
ALLTRIM(STR(rx.rx_no)) + ALLTRIM(STR(rx.refill_no)))) ;
AND rx_claim.statuscode = -1
or,
Take the Alltrim(str()) off
Delete from rx_claim;
Where rx_claim.rx_no = rx.rx_no ;
And rx_claim.refill_no = rx.refill_no ;
And rx_claim.statuscode = -1
Though rx_no and refill_no probably should have been character fields in the first place.
>Hi Gang!
>
>Question....
>
>I've come across some code that I need to speed up and was wondering about this......
>
>in the code below is an ALL scope along with the FOR......
>
>Will the ALL be ignored or will it cause a slowdown in the processing of the FOR ????
>
>
> *TMN 06/21/2011 - remove claim records if a Prefill so we don't have duplicate claim records
> IF Thisform.p_FormType = 3
> DELETE ALL ;
> FOR (ALLTRIM(STR(rx_claim.rx_no)) = ALLTRIM(STR(rx.rx_no))) ;
> AND (ALLTRIM(STR(rx_claim.refill_no)) = ALLTRIM(STR(rx.refill_no))) ;
> AND rx_claim.statuscode = -1 IN rx_claim
> Thisform.m_save(.T.,"rx_claim")
> ENDIF
> *TMN 06/21/2011
>
>
>
>Thanks!
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place