>I am updating a series of PRG's to optimize them for speed and to get them ready to convert into classes.
>
>I am finding statement's like:
>
>
> replace all cpt_code with h->new_cpt for;
> h->new_cpt<>space(10).and..not.subs(h->new_cpt,1,1)$'QHZ'
>>
>My updated version is:
>
>
> REPLACE ALL Cpt_Code WITH Cdm.new_cpt;
> FOR NOT EMPTY(Cdm.new_cpt) AND NOT LEFT(Cdm.new_cpt,1) $ "QHZ"
>>
>
>In the first example, you can see where I replaced the
'<>space(10)' with
'NOT EMPTY()' and
the
'SUBSTR()' with
'LEFT()'>
>
>So my question is, in a program with many of these REPLACE statements, what kind of speed advantages will I see with these changes?
You may actually see a performance hit. Using "<> space(10)" is optimizable where the Empty() function is not. Also the $ operator is not optimzable. So you have made a partially optimable (because 1 side of the AND is and 1 side is not) FOR clause not optimzable at all.
FWIW, to make the statement fully optimzable, go back to the space(10) option and change the $ code to:
NOT (Cdm.new_cpt = "Q" OR Cdm.new_cpt = "H" OR Cdm.new_cpt = "Z")
If you choices are limited to only three, this may help with speed. Otherwise, partially optimzable is better than none.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao