Page 1 of 1

Binary Zero check

Posted: Wed Sep 21, 2005 4:36 pm
by raj_cipher
My Input seq file has binary zeroes in a column.Is there any function to check for binary values (or special characters) in the input file/column. I don't know which column contains binary zero.

Posted: Wed Sep 21, 2005 7:28 pm
by rleishman
I'm not sure, but since no-one else has posted I'll give it a bash.

In the Format tab of your SEQ FILE stage, try setting the the Default NULL string to 000 (hexadecimal zero). This might work, but might kick up a fuss when there are many of them making up a string.

Alternatively, you could use a filter (click "Stage Uses Filter Commands" in your SEQ stage) and write a small C or Perl program to replace \000 with space or "0". The C/Perl program must read from standard input and write to standard output. Then add the name of the program to the "Filter Command" on the Output tab of the SEQ stage.

Ross.

Posted: Thu Sep 22, 2005 12:49 am
by ArndW
Another method would be to use a transformer and check for INDEX(In.Column,CHAR(000),1) being zero or nonzero. The ICONV(String,'MCP') will replace nonprintable characters with '.'

Since you don't know which column contains these values you could try reading the whole record as jut one column, stripping out the offending values with CONVERT(CHAR(000),'',In.String) and writing it back out.