Difference between ISNOTNULL(string) and LEN(TRIM(string))&g

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
bireswar.goswami
Participant
Posts: 33
Joined: Wed Sep 03, 2008 5:48 am
Location: Bangalore

Difference between ISNOTNULL(string) and LEN(TRIM(string))&g

Post by bireswar.goswami »

Hello All,

I am facing problem while using ISNOTNULL(string) and LEN(TRIM(string))>0.

It would be great if someone can please let me know what is the exact difference between them and when should I use what?

Thanks,
Bireswar
Thanks,
Bireswar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Bireswar,

there are a lot of DSXChangers who would help you, but only if you define "facing a problem". There is a very big and very fundamental difference between a NULL string and an empty string; once you get a grasp of that the question will most likely answer itself.

A NULL string is a string which contains an undefined value. An empty string is just a string which has a length of 0 and contains nothing. "Nothing" and "Undefined" are different. Also, a NULL string is undefined and therefore has no length (which is also different from 0 length)
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

I suggest this code:

Code: Select all

If IsNotNull(string)
Then if Len(Trim(string)) > 0
        Then <do something>
Else <do something>
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Consider the string "". This is not null, and has a length of zero.
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