Page 1 of 1

NUL Values

Posted: Sat Sep 24, 2011 11:18 pm
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.

Posted: Sun Sep 25, 2011 2:11 am
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)?

Posted: Sun Sep 25, 2011 9:58 am
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

Posted: Sun Sep 25, 2011 10:12 am
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.

Posted: Wed Sep 28, 2011 4:47 pm
by Magesh_bala
Below convert function helped me to avoid the NUL values.

Convert(Convert(' ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxyz0123456789','', Trim(colname)),'', Trim(colname))

Posted: Thu Sep 29, 2011 10:00 am
by asorrell
That convert function might "work", but it isn't what I would call a good solution, especially because of the performance impact.

Posted: Thu Sep 29, 2011 10:04 am
by Magesh_bala
What is the Best way to handle NUL from the Source?

Posted: Thu Sep 29, 2011 4:26 pm
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)