Trimming the field

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Trimming the field

Post by sujaoschin »

There are 2 input columns A & B where the values will be like below

Column A has values like
smd 14 pin
SMD 16 PIN
SMD
SOT-23

Column B has values like
1
1
1
1

Output column C =Populate the values 'if the column B =1, then concatenate"SMD": column A values'

The result is
SMD smd 14 pin
SMD SMD 16 PIN
SMD SMD
SMD SOT-23

If SMD is repeating twice in the output value , I need to remove the 2nd SMD and populate the output like 'SMD 14 pin'. Please advise.
Sujatha K
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What part do you need help with? The check and concatenation is simple, yes? And it seems like you need to wrap it in a little 'if-then-else' magic to check if A is already 'SMD'.

What have you tried? What's not working about it?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Post by sujaoschin »

I did the concatenation and got the result as

'SMD smd 14 pin'

From this above result, I need to remove the 2nd 'smd' as it is repeating twice and final output should be 'SMD 14 pin'.
Sujatha K
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Post by sujaoschin »

What I did now is before concatenation with SMD , I checked for the field B is having 'SMD' or 'smd' using the expression below like

if column B = 1 AND LEFT(column A value,1,3) <>'smd' then "SMD ":Column A value
else
Column A value


The above command is checking for 'smd' alone. Is there any command in datastage server to get he first 3 characters irrespective of the UPPER OR LOWER case using LEFT.
Sujatha K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Just wrap an UpCase() or DownCase() function around whatever it is you're comparing.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sujaoschin
Premium Member
Premium Member
Posts: 102
Joined: Tue Jan 31, 2006 4:13 am

Post by sujaoschin »

Thank you and I used the Downcase () and Upcase () and resolved this problem.
Sujatha K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

One should have done it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
fareeda_b
Participant
Posts: 48
Joined: Sat Feb 23, 2008 4:25 pm

Need explanation on Downcase () and Upcase ()

Post by fareeda_b »

HI SujathaK,

Could you please give me xplanation how you used the Downcase () and Upcase () to resolved ur problem?

thanks in advance
fareeda
Thanks
fareeda_b
Participant
Posts: 48
Joined: Sat Feb 23, 2008 4:25 pm

Need explanation on Downcase () and Upcase ()

Post by fareeda_b »

HI SujathaK,

Could you please give me xplanation how you used the Downcase () and Upcase () to resolved ur problem?

thanks in advance
fareeda
Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You only need one or the other, not both:

AND UPCASE(VALUE) = 'XXX'

-or-

AND DOWNCASE(VALUE) = 'xxx'
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply