How to convert columns of table having Hex values to text

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
sanygup
Participant
Posts: 34
Joined: Thu Sep 20, 2012 10:19 am
Location: newdelhi

How to convert columns of table having Hex values to text

Post 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
Aspirant
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
sanygup
Participant
Posts: 34
Joined: Thu Sep 20, 2012 10:19 am
Location: newdelhi

Post 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.
Aspirant
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
sanygup
Participant
Posts: 34
Joined: Thu Sep 20, 2012 10:19 am
Location: newdelhi

Post by sanygup »

thnx, it works.
Aspirant
Post Reply