Dealing with Null columns

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Dealing with Null columns

Post by yaminids »

Hello there,

I have the following columns in a table: 'Name', 'ssn, 'age'.
The values for these columns are:

SUN 6666 24
5555 26
Raj 7777 25
8888 23

The first column contains Null values. I am trying to separate this into two files based on the column 'Name'. I am using IsNull(Name) then 'file1' else 'file2' condition. This is working fine when the value in the 'Name' column is 'null'. But when there are some spaces in the 'Name' column instead of Null this condition is not working.

Can anyone explain to me what the problem is.

Thanx in advance.
-Yamini
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

NULL is not the same as spaces. ISNULL is used to detect for the null condition, but to check for spaces requires that you do a string comparison.

If you want to trim for spaces and then check for blank and also deal with the null condition, use the following statement:

Code: Select all

NOT(ISNULL(link.column)) OR LEN(TRIM(link.column)) > 0
Non-spaces or not null will evaluate to TRUE.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

Can you paste your code with the sample input you are using?

It appears you doing correct.

Ketfos
Post Reply