Default value for Continue option in Lookup

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
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Default value for Continue option in Lookup

Post by wahi80 »

Hi,

Im doing a lookup with a sequential file as source and a reference dataset.
The requirement is that if there are 100 rows in source there should be 100 in output after the lookup. Hence I used the Continue option in case of lokkup failure.But another need is that all numeric fields should be populated with value -99 if lookup failed and these fields were not populated. Currently the value is 0,hence I'm unable to midentify if the 0 is due to lookup failure or it was already a value in the field.

Regards
Wah
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can not do this in the Lookup stage itself (one stage, one task) but can do so in any downstream Modify or Transformer stage. Pass the columns from the reference link to the output and replace null with -99 as required.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Post by wahi80 »

Hi Ray,

But the problem is that the lookup is populating 0 for these numeric fields.
Im unable to distinguish if the 0 is beacuse the lookup matched or because there was no match.

Regards
Wah
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make the output fields nullable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Post by wahi80 »

I made the fields nullable, but for integer fields a value of 0 is still populate but for varchar fields null is populated
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's fine, use one of the VarChar fields to test whether the lookup was successful or not. Ideally use a field that is not null in the reference source, so that you can be confident that, if it is null on the output, this is because the lookup failed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Post by wahi80 »

My job looks like this:

Code: Select all

                    
                        RefCharLkp
		                   |
		                   |
		                   |
		                   |
SourceSeqFile----------Lookup---------OuSeqFile
		                   |
		                   |
		                   |
		                   |
		                   |
	                      RefNumLkp                    
 
The problem is any rows not matching with RefCharLkp, the value of null is populated for the column, but for rows not matching RefNumLkp 0 is populated. Hence Im unable to make out the difference.

Regards
Wah
Meera
Premium Member
Premium Member
Posts: 21
Joined: Mon Nov 28, 2005 8:42 pm

Post by Meera »

Try using Reject option in Lookup stage instead of continue. For the records which are coming from the Reject link, apply the necessary derivation by using a transformer or any other suitable stage. Then combine the results from both the links finally.
wahi80
Participant
Posts: 214
Joined: Thu Feb 07, 2008 4:37 pm

Post by wahi80 »

I will have to reject records for the RefNumLkp only and use Continue for RefCharLkp, and then combine both.
This is just a sample job I put, the actual job has many numeric lookups in different Ref files. I guess I will either have to break up the jobs or use successive stages of lookups :(
manuel.gomez
Premium Member
Premium Member
Posts: 291
Joined: Wed Sep 26, 2007 11:23 am
Location: Madrid, Spain

Post by manuel.gomez »

I am really surprised how some tasks that were so easy in Server, becomes so difficult and results in tons of stages in your canvas in Parallel
This, in server could have been accomplished with a simple Transformer receving as many hash files as need

I guess this is forced to get benefits of partition processing, but gets designing much harder....
Post Reply