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
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Lookup stage

Post by srinivas.nettalam »

Hi ,
Please let me know whether the conception below is right.
If the primary and reference links have the same column names for non-key columns, then even though the reference column is pulled the data in it is the data from primary link's column.
Please let me know on this ....
N.Srinivas
India.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

You really haven't given enough information - I am presuming that your question refers to a Lookup stage.

The answer is "maybe". On the output link of the stage you can control which input columns get mapped to output columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Question on Lookup stage

Post by srinivas.nettalam »

Sorry for not being clear.Here is my concern.Primary link has 2 columns EMP_ID ,EMP_NAME and Reference link has 2 columns EMP_ID and EMP_NAME.key to lookup is EMP_ID and EMP_NAME from reference is mapped to output.Though reference.EMP_NAME is mapped ,the data in that would be the data from primary link,is that true?[/quote]
N.Srinivas
India.
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

Yes, because if the lookup fails (and you have Continue selected in the input link's Lookup Failure option) then you will get the stream's value and not the NULL of a failed lookup. You can map the lookup link's value to another field if you want, so that you can see which ones failed the lookup further downstream.
Phil Hibbs | Capgemini
Technical Consultant
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

PhilHibbs,
Thank you very much.
N.Srinivas
India.
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

Does it happen only when "continue" is selected?what data would be present if any of the other options is selected?
N.Srinivas
India.
jpraveen
Participant
Posts: 71
Joined: Sat Jun 06, 2009 7:10 am
Location: HYD

Post by jpraveen »

Hi Srinivas

Continue is like LEFT JOIN,
Drop is like INNER JOIN,
Reject- the record goes to Reject link,
Fail-we can make Lookup to fail when the condition not met and tha job grt Aborted.
Jaypee
kwwilliams
Participant
Posts: 437
Joined: Fri Oct 21, 2005 10:00 pm

Post by kwwilliams »

In your case continue would not be recommended. You should chose reject which would allow you to separate out your matched and unmatched records from the lookup.

You can then handle your rejects (set the empid and name to null or some other value) and then funnel the results together. In general this type of construct gives more visibility into what is occurring in the job. Many people prefer to continue and then handle the lookup failure in a downstream transformer. I prefer to lookup and reject, because it give more verbose information to whomever would be supporting the ETL I write.
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

Please pardon me for not being clear with the question from the beginning.
My question is only regarding the functionality of lookup stage only and not regarding any requirement.

If the primary and reference have same column name as per my previous question ,and reference.EMP_NAME is mapped to ouput,the data that flows to output is from stream.EMP_NAME though stream.EMP_NAME is not mapped to any of the output columns
N.Srinivas
India.
kwwilliams
Participant
Posts: 437
Joined: Fri Oct 21, 2005 10:00 pm

Post by kwwilliams »

Interview question??

If you use continue and mapped the reference as the output, the result would be null if the lookup failed and you would have to handle it downstream.

Reject would only allow matches out the primary stream while creating a reject stream.

Fail would cause the entire job to fail.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Yes, Datastage will drop the columns from the Lookup internally and will Keep the columns from Main stream to the output.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply