If then else problem

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

If then else problem

Post by somu_june »

Hi,

I have defined a stage variable Region and it is char and length 20 and in derivation section I defined as IF src.country = 'IN' then 'ASIA' Else if src.country = 'GE' then 'EUROPE' Else if src.country = 'US' then 'North America' Else 'Dummy' and source country column is char(30)

But Iam getting the output for the derivation even for IN, GE and US as 'DUMMY' instead of ASIA, EUROPE and NORTH AMERICA.

Can some one tell me where Iam going wrong in the derivation field


Thanks,
SomaRaju.
somaraju
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Its defined as char(20) so 'ASIA' will have 16 trailing spaces. Change it to varchar and TRIM the column before doing your comparison.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Post by somu_june »

Hi,


Thanks for solving my problem






Somu
somaraju
Post Reply