NULL check

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
New2DS
Participant
Posts: 33
Joined: Sat Jun 26, 2004 9:58 am

NULL check

Post by New2DS »

Hello All,

Which is the good idea to check for nulls if the source is a seqfile. Either '' or @NULL if the 'Defalut null string' text filed is blank on the format tab.

thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A good idea? Checking for both would make it harder to go wrong.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Comparison against @NULL is meaningless; the result is necessarily "unknown". That is, you can't legitimately say Col = @NULL and expect it to behave in a Boolean fashion (in fact, there are rules in DataStage that govern the behaviour under these circumstances, but won't yield the results you expect).

The only valid way to test for null is to use the IsNull() function. Therefore to test for either condition being true you need an expression like

Code: Select all

IsNull(InLink.ColumnName) Or (InLink.ColumnName = "")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:Comparison against @NULL is meaningless; the result is necessarily "unknown". That is, you can't legitimately say Col = @NULL and expect it to behave in a Boolean fashion (in fact, there are rules in DataStage that govern the behaviour under these circumstances, but won't yield the results you expect).
I was assuming people here have a basic grounding in three value logic and know that you can't check if something 'equals' NULL. :? I'm loath to hit them with that stick unless it is actually needed... but perhaps, for the sake of the Greater Good, that shouldn't be assumed here. :cry:

On a side note, I now use your 'barrel of apples' analogy when needed to make the point... I though it was great! Paraphrasing:
ray.wurlod wrote:I have an unknown number of apples in a barrel. I now add three more apples to the barrel - how many apples are in the barrel?
:lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To get a definitive answer we also need to incarcerate Schrodinger's cat in the barrel, and request the answer from the cat. Perhaps Heisenberg could also be engaged as a consultant. Ultimately everything's about quantum, even chaos.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply