Identifying Null values - "|||"

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
vnspn
Participant
Posts: 165
Joined: Mon Feb 12, 2007 11:42 am

Identifying Null values - "|||"

Post by vnspn »

Hi,

We are currently loading data from an external source to a Sequential File. I have certain records containing NULL value for a particular column. I need to filter out those records. Those NULL values show in the output flat file as "|||||". I'm not able to filter out those records using the function "IsNull".

Any idea on what could be the means for identifying these NULL values.

Thanks.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

There's NULL (ASCII 0 ) and then there's blank (zero length string). The only way to detect a NULL is using the ISNULL() function, but zero length string can be checked with LENGTH() and comparison to "".

So, you probably need to check for both because when DS Server writes a NULL to a sequential file it actually turns it into a blank, thus two field delimiters side-by-side. But, when it writes a blank, it writes a blank. There's no way to tell what the data was originally, because NULL and blank are written as a blank. So, when comparing, you need to consider both situations.

Either write a Transform or a Function to handle both cases, maybe something like an "Exists" Transform/Function.

Code: Select all

If ISNULL(Arg1) OR Arg1 = "" Then @FALSE Else @TRUE
This simple piece of code checks both conditions and returns TRUE if the value exists.
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
vnspn
Participant
Posts: 165
Joined: Mon Feb 12, 2007 11:42 am

Post by vnspn »

Thanks for your reply Kenneth. Yes, I did try to handle both these conditions. The NULL value doesn't get recognized by both of these conditions.

Is there any more way of handling the NULL values?
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

The value might not be NULL then, view the data in your sequential file using a hexeditor and try to identify what they actually are.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Then it's not a NULL or has some length other than zero. This implies that there's something there, however you're attempting to view it is not sufficient. A hex editor is a great way, using Windoze Notepad is not. Consider writing an extra output column that contains the length of the value written to the preceding column. Better yet, if the length is 1, consider writing the ASCII value out. You could be missing a high/low ASCII value that is not easily viewable.
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
vnspn
Participant
Posts: 165
Joined: Mon Feb 12, 2007 11:42 am

Post by vnspn »

Yes, you are correct. It was not NULL but the column had contained binary zeros in them. I used CHAR(000) to identify them and the trim those columns.

Thanks for your inputs.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

A useful trick is that Len(@NULL) returns zero. Len("") also returns zero.
Len(Char(0)), however, returns 1.
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