NUL Values

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
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

NUL Values

Post by Magesh_bala »

Hi All,

I have the sequential file with the Values as

Kumar[NUL][NUL]
Bala[NUL][NUL]

In a single column, I need to remove the [NUL] values from it and lkp with reference data. your help will be highly appreciated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

By "[NUL]" do you mean those five characters, do you mean the ASCII NUL character (Char(0)), or do you mean something else (and, if so, what)?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

When I open the file in Notepad++ one of the column show as

Kumar[NUL][NUL]
Bala[NUL][NUL]

It looks like ASCII characters, I tried filter option in sequential file

tr -c '\0\ '' But it didnt work
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Forget anything like notepad, what does a UNIX hex editor show? Or a dump like "od -h" or whatever will give you a hex dump on your O/S.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Below convert function helped me to avoid the NUL values.

Convert(Convert(' ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxyz0123456789','', Trim(colname)),'', Trim(colname))
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

That convert function might "work", but it isn't what I would call a good solution, especially because of the performance impact.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

What is the Best way to handle NUL from the Source?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Once you know what it really is, a simple Convert() function to remove it - to convert it to "" - will do the trick.
Imagine that it happens to be the ASCII NUL character (0x00).
Declare a stage variable svNUL of type Char(1) and initialize it to Char(0).
When tidying up your string in the job

Code: Select all

Convert(svNUL, "", InLink.TheString)
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