LookUp Problem

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
arunselvaraj
Participant
Posts: 3
Joined: Sat Dec 01, 2007 7:18 pm
Location: India

LookUp Problem

Post by arunselvaraj »

Iam trying to lookup a char(1) column with varchar(30) column. But iam not getting null for not matched record in the lookup. When iam looking the records in the dataset after lookup, iam having a blank field but it is not null. I need null when the column is not matched.Please anyone give me an idea what is happening there??
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Welcome to DSXchange, arunselvaraj.

(that red is very difficult to read)
If the column coming from the lookup is declared as nullable=Yes and your lookup is set to "continue" on failed lookups then the value will be null. What are your nullability settings in your job and please explain which column is Char and which VarChar?
arunselvaraj
Participant
Posts: 3
Joined: Sat Dec 01, 2007 7:18 pm
Location: India

Post by arunselvaraj »

Iam looking up column named start_c char(1) from a dataset with nullable=no and code_val_c varchar(30) from a db2 stage with nullable=no.My lookup is set to "continue" on failed lookups. Iam getting all the matched and unmatched from the lookup. But while checking the nullability for the unmatched records in transformer, i came to know tat null are not coming for the unmatched one.

I checked with isnull(Code_val_c) in transformer. But iam getting only 0. Then i came to know tat null is not coming
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Set the column Code_val_c to be nullable from your lookup and try again.
arunselvaraj
Participant
Posts: 3
Joined: Sat Dec 01, 2007 7:18 pm
Location: India

Post by arunselvaraj »

I too tried tat...but all in vain. For the unmatched records, null is not coming. i dono whether it is blank space.
iam worried what is happening there??
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Put in an additional column for testing, setting it to 1 if "In.Code_val_c=' '" and 0 otherwise and you'll know the answer.

I doubt that you correctly set the nullable attribute in the DB column, otherwise failed lookup column will be coming back as null.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Have you set default values for these 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.
WDWolf
Charter Member
Charter Member
Posts: 14
Joined: Mon Dec 05, 2005 12:06 pm

Post by WDWolf »

I think you need to step back and look at what ArndW said. FRom your description not sure if you are using a lookup fileset or a db2 stage directly, but the field in the lookup must be created nullable (assuming fileset) and the metadata in the job at hand also set this way. Basically all of the fields, input, lookup, output side of lookup must be created as nullable to get this to work correctly...I see it all the time here (ver 7.5.1a)
William Wolf
Wolf Consulting
612-719-9066
Post Reply