The IF statement
Posted: Fri Aug 20, 2004 8:14 am
Hallo
Which IF statement is recommended, bearing in mind that the correct results, performance and ability to understand is what we are after..
or...
Which will bring back the correct results?
If they return different values different.. why?
Which is faster to interpret by DS? Is the second piec of code resulting in 11 reads (maximum) and the first set only resulting in 2 reads (maximum)?
Which IF statement is recommended, bearing in mind that the correct results, performance and ability to understand is what we are after..
Code: Select all
if NOT(LINK_LOOKUP.NOTFOUND) and
(
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 2610 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 2710 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5810 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 1409 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 7526 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 1426 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5837 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 9405 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5745 or
trimb(LINK_ROLLUP.ORGTG_IBT_N) = 3145
) then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else
LINK_ROLLUP.CASH_A
Code: Select all
if NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 2610 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 2710 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5810 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 1409 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 7526 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 1426 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5837 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 9405 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 5745 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else if
NOT(LINK_LOOKUP.NOTFOUND) and trimb(LINK_ROLLUP.ORGTG_IBT_N) = 3145 then
LINK_ROLLUP.CASH_A + LINK_LOOKUP.CASH_DEP_R100_CC_A else
LINK_ROLLUP.CASH_A
If they return different values different.. why?
Which is faster to interpret by DS? Is the second piec of code resulting in 11 reads (maximum) and the first set only resulting in 2 reads (maximum)?