String pattern matching in lookup stage!!!

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
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

String pattern matching in lookup stage!!!

Post by kiranredz »

Hi,

I have a requirement i am doing a lookup based on strign field and am suppose to use the contains logic to match.

Ex: If my source is "washington" and the value in the lookup is "washington DC USA", these records should match. Actually these are unmatched records.

But the requirement is that these should be matched similar to the string pattern matching using "like" in oracle.

How can I implement this requirement?
I already have a lookup stage where am looking up on the same fields mentioned above. if this requirement of mine can be implemented in the same lookup, it would be great.

I cannot take a substring of the data and do the lookup(Ex: Field[1,5]). Coz, if i restrict the data to certain length, i'll have duplicates from the lookup which would fetch me an invalid value.

Thanks in advance,
Kiran
Romy
Participant
Posts: 26
Joined: Thu Nov 13, 2008 3:37 am
Location: Chennai

Post by Romy »

is that enough if you match the first word(whatever length) of the string.... will it be ok for your requirement.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In version 7 the only possible normal lookup you can do with a Lookup stage is an equality lookup (an exact match is required). You might contemplate using a sparse lookup that includes a LIKE condition in user-defined SQL. But it won't be fast.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

Post by kiranredz »

Romy wrote:is that enough if you match the first word(whatever length) of the string.... will it be ok for your requirement.

yes. Thats fine. how can we do that?
Kiran
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

Post by kiranredz »

ray.wurlod wrote:In version 7 the only possible normal lookup you can do with a Lookup stage is an equality lookup (an exact match is required). You might contemplate using a sparse lookup that includes a LIKE condit ...
hi ray,
Am working on version 7. Could you pls explain me how i can implement this using sparse lookup?

I know how a sparse lookup woks. I just wanted to know whether i've to include some logic using SQL.
Kiran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use user-defined SQL in the database stage that services the reference link.

(Sparse lookup is not available for all database types.)
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