Lookup logic

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
mail2hfz
Premium Member
Premium Member
Posts: 92
Joined: Thu Nov 16, 2006 8:51 am

Lookup logic

Post by mail2hfz »

Hello All,

I have a requirement where-in I have to lookup for each word in a field against a table and fetch the value from the table if a match is found else pass the source value as is. I have searched in the forum but could not get a direction.

Code: Select all

Eg: Sample Input
Field1   ==> one of the col in the file
"ABC is Techie giant"

Reference Table:
Field1         Field2
ABC           DEF
Techie        GHI
giant          KLM

Expected output:
"DEF is GHI KLM"
I have started with, splitting the Field1 in i/p into multiple columns and then copy Filed1 in reference table into multiple columns for lookup but did not seem to work. May be the hard way of doing it is seperate lookups for each word found!!! I am not sure.

Can anyone shed some light on this or direct me to a post where this is discussed before.

Thanks
mail2hfz
Premium Member
Premium Member
Posts: 92
Joined: Thu Nov 16, 2006 8:51 am

Post by mail2hfz »

I am able to get this done with seperate lookups. Would like to know if any other way I can achieve it.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Break one record with multiple words into multiple records with one word each. Include row number and word number to each record.

Do a lookup and join them back together.

Also search for TRANS() function to perform lookup inside code.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

mail2hfz wrote:I am able to get this done with seperate lookups. Would like to know if any other way I can achieve it.
No. According to your explanation each word/token must be looked up individually.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
grimm336
Participant
Posts: 12
Joined: Thu Jun 25, 2009 10:19 am

Post by grimm336 »

After splitting the sentence in to columns try to validate each column one by one with the reference data....

Then use tranformer to get the sentence from the columns...you know how to do this

cheers....
grimm
Post Reply