Page 1 of 1

How to convert columns of table having Hex values to text

Posted: Wed Sep 25, 2013 5:53 am
by sanygup
Hi All,

I have table having column with Hex values. How can I convert those Hex values to plain text using DataStage job? Which stage can help me in achieving the same?

Thanks,

Sanygup

Posted: Wed Sep 25, 2013 5:56 am
by prasson_ibm
I remember i have converted text to hex using basic trasformer stage,so there must be some conversion function to convert Hex to text.

Code: Select all

OCONV(to_tsfm_hex.ntfEventpayload,"MX0C")
This may help you.

Posted: Wed Sep 25, 2013 5:56 am
by ArndW
What sort of hexa(decimal) values do you have and what is the datatype of the columns in question?

It is quite different to have a VarChar() field containing "0x20" or a 8-bit binary field containing the value 0x20.

Posted: Wed Sep 25, 2013 8:08 am
by sanygup
Hello,

I would like to give little background of my actual problem.

I have table which is having blob datatype column having values from rich text editor having basic word pad type formatted text.

I have to migrate this data to another database for some requirement using datatstage 8.5. I have used longvarbinary datatype of datastage odbc connector for the blob column of that table. When I check the value I found out that there are actually hexa.

I would to translate that hexa values into plain text so that I cannot report the information.

Posted: Wed Sep 25, 2013 8:18 am
by ArndW
sanygup wrote:..I have used longvarbinary datatype of datastage odbc connector for the blob column of that table. When I check the value I found out that there are actually hexa...
That tells me that the values are stored in binary form and that your hexadecimal isn't the data contents but a representation thereof. This means that your text values don't need to be converted - but you need to get them out of the binary field and into a text field. I believe that there is a "RawToString()" function in PX, but I haven't used it.

Posted: Thu Sep 26, 2013 11:27 am
by sanygup
thnx, it works.