isnull function

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
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

isnull function

Post by dnat »

Hi,

I have an oracle stage as input where there are null values in field A.

The next stage is a transformer, and in the stage variable i want to do some validations based on the field A's value.

I use this function

Code: Select all

If isnull(Lnk.A) Then 1 Else 0.
But even if the value is isnull, it always goes to the else condition and executes it.

If i do the same thing in derivations, it is working fine..

What could be the issue.
antonyraj.deva
Premium Member
Premium Member
Posts: 138
Joined: Wed Jul 16, 2008 9:51 pm
Location: Kolkata

Post by antonyraj.deva »

If the value is null then, are you to trying to assign a value as '1' for the stage variable and else as '0'? :?:
TONY
ETL Manager
Infotrellis India

"Do what you can, with what you have, from where you are and to the best of your abilities."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you build the stage variable expression using the expression editor (selecting operands and operators from menus) or manually?

Incidentally, a sufficient expression would be

Code: Select all

IsNull(Lnk.A)
Boolean expressions return 1 for "true" and 0 for "false".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Post by soumya5891 »

Check the value properly,whether the value is null or empty.
Soumya
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

To follow up on soumya's comment: within DataStage, an Empty string is not the same as a Null string. An empty string contains no data and has a length of zero...it is not flagged as a NULL. IsNull() will not see an empty string as a null...you must check for the emptiness separately.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

What is the "Nullable" option set to? If it is set as "NO", then you might not be getting nulls during run time in DataStage, even if you can see Nulls in the Database. Also, jwiles and Soumya's comment should also be looked into.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

Post by dnat »

Hi,

i manually typed in the code, just to mention that i am using a isnull() function.

When i see the input data through datastage using "View Data", the fields are having values as "NULL". And when i use the same code in derivations, it works. Only in stage variables it is either not considering the input value as a null(even though it is null), or this function has come problem working in a stage variable.

Nullable option is set to "Yes" throughout the job for these fields.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

We use the IsNull function extensively, including in stage variables. So, I can confidently say it works. Normally, these kind of scenarios arise by the handling of the data by the tool (w.r.t the Nullable property settings and the data types). Obviously, this is defined by the developer, so it is in our control.

Did you put intermediate files or peek stages and see the data flow at every spot to determine what is going on?
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Post by soumya5891 »

Try with other null handling functions and see it works or not.Convert null to some default value and check that value
Soumya
Post Reply