lookup_int16_from_string

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
thanush9sep
Premium Member
Premium Member
Posts: 54
Joined: Thu Oct 18, 2007 4:20 am
Location: Chennai

lookup_int16_from_string

Post by thanush9sep »

Hi all

My Requirement to be done in Modify Stage

IF input_column='2'
THEN 'Y'
Else 'N'

Input column is Integer
Target column is Varchar

I have gone through the Posts and Found
lookup_string_from_int16() and lookup_int16_from_string() functions

According to my understanding , I understand that we can search only Strings !!!!

Please help me with my requirement with Modify stage only ....
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can do either lookup. But there's only one format for the {table_definition} that you include in the function. Review the manual carefully - it is properly explained there.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thanush9sep
Premium Member
Premium Member
Posts: 54
Joined: Thu Oct 18, 2007 4:20 am
Location: Chennai

Post by thanush9sep »

TargetName = lookup_string_from_int16[{default_value = 'N'} (2='Y';)](SourceName)

This is what i tried but failed...
Regards
LakshmiNarayanan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You still need 'N' in the lookup table, even though you've set it as default value (if I understand your requirement correctly). Can you be more specific about what "failed" means in this instance? What output do you get?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Even though it may be counter-intuitive, try reversing the pairs in the table definition.

Code: Select all

TargetValue:string = lookup_string_from_int16[{default_string='N'}('N'=1; 'Y'=2;)](SourceName)
Note, too, that default_value property is only for int data types - for strings the property to use is default_string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply