Page 1 of 1

Unable to see the non printable characters

Posted: Wed May 14, 2014 7:43 am
by anu123
Our file has different record types. It is a text file with ASCII data. Delimiter is a non printable character.

I am trying to read the data in single column and then divide the records.

But when I am trying to read the data in single line, when I say view data I could not see the non printable characters (I mean they even doesn't appear as boxes).

Kindly give me your thoughts.

Using sequential file to read the data.

Posted: Wed May 14, 2014 12:06 pm
by qt_ky
Are you asking how to determine what character the delimiter is? From unix command line, this command will tell each character's value in hex. I suggest you run it on a small 1 or 2 line sample file.

Code: Select all

od -x file.txt

Posted: Wed May 14, 2014 12:13 pm
by chulett
Or:

Code: Select all

head -2 file.txt | od -x

Re: Unable to see the non printable characters

Posted: Wed May 14, 2014 12:16 pm
by anu123
No I am not asking about how to find what is the character.

Suppose in the file the data is delimited by ASCII 26, like A(ASCII 26)B, when I define single column in seq file stage and click on view data, I ma seeing AB in place of non printable character I don't see a box or anything.

Later I want to split that record into two columns in Transformer, How should I do that ? (Apart from doing that in the sequential file stage while reading the file..)

Posted: Wed May 14, 2014 3:26 pm
by ray.wurlod
In the Transformer stage, use Field(InLink.Line, Char(26), 1, 1) and similar.

Performance tip: initialize stage variable to Char(26) and use the stage variable name as the second argument of the Field() function - that way the Char() function is evaluated only once.

Posted: Wed May 14, 2014 11:49 pm
by ssnegi
replace the non-printable character with , or some other delimiter.
You can do this by Sed, awk utilities.
Then read the file into datastage.

Posted: Thu May 15, 2014 7:06 am
by anu123
Thanks Ray. It worked. Actually when reading the file before I was using \x1A, so in filed function I was trying with that and just 1c (I kind of know that this is wrong as the data may contain 1c) which are the hexadecimal values.

Thanks ssnegi for the alternative. But I wanted to do that in Datastage.