Posted: Tue May 03, 2005 1:57 pm Post subject: Transform String in HEX format to ASCII representation
Novice
Joined: 06 Oct 2004 Posts: 11
Hi! first of all, sorry for my english, I'm a chilean people.
I have an xml message where it comes a value that is in HEX format. I have to transform this HEX "string" into the ASCII representation.
With an example:
The input message is
<TRX>
<someValue>A001</someValue>
<otherValue>0125</otherValue>
</TRX>
I need to transform this values to
<TRX>
<result>..</result> [A0 and 01 has no representation in ASCII]
<result>.%</result> [01 same as above end 25 is % in ASCII]
</TRX>
with the following ESQL (as example) code:
DECLARE blbCDATA BLOB;
DECLARE chrDATA CHAR InputRoot.XML.TRX.someValue;
SET blbCDATA = CAST(chrDATA AS BLOB);
SET chrDATA = CAST(blbCDATA AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.XML.TRX.result=chrDATA;
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
Hi,
I'm not exactly sure why you don't get it to work. I tried your code and it worked right off (as I would have expected, since it is correct). I can only assume that maybe your message comes with the wrong CCSID or some other such thing.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum