lookup operator.

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
srikanthd1978
Charter Member
Charter Member
Posts: 38
Joined: Wed Mar 17, 2004 1:16 am
Location: USA

lookup operator.

Post by srikanthd1978 »

..hi.

.. lets say we have the following requirement...

..there is a decimal field in ur CFD (u r reading from a Mainframe file) say X..and in ur job u perform a lookup where one of the reference links is from a LkpFileset..now what u have to do is .. when the lookup is successfull, u need to get the value of X from the refernce link, and when the lookup is unsuccessfull then u want a default value to be present for our clmn X..How do u accomplish this witout using the Transformer....the operators that i am uing are .. primary source : datset, reference source : LkpFileset, and a lookup operator..target: datset.

all inputs are welcome..

now in a server job ur reference source is a hash file and in ur Xfmer.. u specify If LookUp Found do this else do that.. how do u get the same funcationalty in PX..

sorry for the length of the msg..but i hope u got my point..


thanks,
srikanth.
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi Srikanth,

In the lookup stage you have 4 options if the lookup is not found. The options are 1. Continue 2. Abort 3. Reject and 4. Drop. I hope if you use the first option and say to continue a null will be passed to the output. Then you can pass the output to the modify stage and do the null handling to update with the default value.

HTH
--Rich

Pride comes before a fall
Humility comes before honour
srikanthd1978
Charter Member
Charter Member
Posts: 38
Joined: Wed Mar 17, 2004 1:16 am
Location: USA

Post by srikanthd1978 »

rich..

.. i have observed that the lookup stage does not throw out a null when the lookup is not found, it just passes an empty string with the Continue option in the lookup stage.....Now we will be looking at a function that converts an EmptyString to NULL..i am not sure weather we have this...

Thanks,
srikanth.
RobertScarbrough
Participant
Posts: 24
Joined: Fri Oct 01, 2004 1:43 pm
Location: USA

Post by RobertScarbrough »

S,

I have coded a lookup stage with several reference links and was able to check for null values on downstream in a transform successfully when a value was not found. I think one of the tricks is that the source value must be nullable (not really sure why) and the target must be nullable (this makes total sense). Try working with those settings and see if it works.

-rls
Post Reply