Why non-nullable record is rejected after lookup failed?

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
Yuan
Participant
Posts: 3
Joined: Wed Jan 09, 2008 1:52 am

Why non-nullable record is rejected after lookup failed?

Post by Yuan »

Hi, I got a problem about lookup stage

I have a non-nullable column(varchar) from input like Lnk_input.Column1, and updated its value using lookup stage. The output is something like Lnk_output.Column1. The lookup stage is set to "continue after lookup failed".

According to the DataStage document, Lnk_output.Column1 will be assigned a default value if lookup failed. And I'm expecting that "default value" to be the same as input link(Lnk_input.Column1). So the logic I'm trying to implement is: if lookup success, use the new value; else use the original one. But, the record is just rejected silently.

Does someone has some idea? I know this could be implemented using Transform stage. But I'm just wondering if there is a "build-in" way in lookup stage for this. Thanks!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If your lookup fails and the Lookup Failed rule is Continue then every column from the reference input is set to NULL. You are not permitted to send NULL into an output field that it not nullable. Therefore, failure.

Inspect the output fields' extended properties. Do you have Default property defined for every one of them?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Yuan
Participant
Posts: 3
Joined: Wed Jan 09, 2008 1:52 am

Post by Yuan »

But I found no place in the loopup stage to set a default value for the column. The extended property is shown as "None available"
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Yuan wrote:But I found no place in the loopup stage to set a default value for the column. The extended property is shown as "None available"
you want a piece of cake ready to eat!

Just pass the stream link attribute along with the value getting from reference link after making it nullable.

and in down stream transformer check if the value from reference link is null then pass the value of stream link.

Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Yuan
Participant
Posts: 3
Joined: Wed Jan 09, 2008 1:52 am

Post by Yuan »

priyadarshikunal wrote:
Yuan wrote:But I found no place in the loopup stage to set a default value for the column. The extended property is shown as "None available"
you want a piece of cake ready to eat!

Just pass the stream link attribute along with the value getting from reference link after making it nullable.

and in down stream transformer check if the value from reference link is null then pass the value of stream link.

Regards,
Yeah, I know this gonna to work. I just want to know whether there's a way to avoid this kind of manually null-checking and what's the "default value" in the document means. Now I guess maybe this is the only way to resolve then.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Yuan wrote:
priyadarshikunal wrote:
Yuan wrote:But I found no place in the loopup stage to set a default value for the column. The extended property is shown as "None available"
you want a piece of cake ready to eat!

Just pass the stream link attribute along with the value getting from reference link after making it nullable.

and in down stream transformer check if the value from reference link is null then pass the value of stream link.

Regards,
Yeah, I know this gonna to work. I just want to know whether there's a way to avoid this kind of manually null-checking and what's the "default value" in the document means. Now I guess maybe this is the only way to resolve then.
Here default value is null thats why you can't pass it to non nullable column in lookup stage with lookup failure mode as continue.

One more way is to set lookup failure mode as reject and then funnel reject link output with stream link output via copy stage where you need to change the column name to synchronize it with stream link metadata.

Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply