Author |
Message
|
fatima |
Posted: Wed Mar 03, 2010 12:54 am Post subject: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Newbie
Joined: 30 Sep 2009 Posts: 7
|
Good Day,
I am trying to convert from Hex to ASCII and I am receiving BIP2590.
My Environment is as follows:
Windows XP Professional Version 2002 Service Pack 3
Message Broker version 6.1 Fixpack 6.1.0.4
MQ v7.0
The Hex sting is 24 bytes long and contains all printable characters when it is converted to ASCII
HEX string = X'4F4C32303130303231353135303332373633343434343434'
And I would Like to convert it, so that is can be displayed as follows on the Q:
ASCII String = 'OL2010021515032763444444'
Code used:
DECLARE v_fatima BLOB '4F4C32303130303231353135303332373633343434343434';
SET v_fatima = CAST (v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding );
PS: Note the hex string is hard-coded in the flow in oder to problem solving only.
Error Message from Trace File:
Time : 2010-02-26 13:24:31.509019
Exception : ( ['MQROOT' : 0xa6ec950]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\DataFlowEngine\ImbComputeNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 464 (INTEGER)
(0x03000000:NameValue):Function = 'ImbComputeNode::evaluate' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'service/EQN/transformNoticeInstructReq/transformNoticeInstructReq#FCMComposite_1_6' (CHARACTER)
(0x03000000:NameValue):Label = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq.transformNoticeInstructReq' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2230 (INTEGER)
(0x03000000:NameValue):Text = 'Caught exception and rethrowing' (CHARACTER)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 602 (INTEGER)
(0x03000000:NameValue):Function = 'SqlStatementGroup::execute' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'service/EQN/transformNoticeInstructReq/transformNoticeInstructReq#FCMComposite_1_6' (CHARACTER)
(0x03000000:NameValue):Label = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq.transformNoticeInstructReq' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2488 (INTEGER)
(0x03000000:NameValue):Text = 'Error detected, rethrowing' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq_EQN.Main' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '4.3' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'CopyEntireMessage();' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlRoutine.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 548 (INTEGER)
(0x03000000:NameValue):Function = 'SqlRoutine::invoke' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'service/EQN/transformNoticeInstructReq/transformNoticeInstructReq#FCMComposite_1_6' (CHARACTER)
(0x03000000:NameValue):Label = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq.transformNoticeInstructReq' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2934 (INTEGER)
(0x03000000:NameValue):Text = 'Error occured in procedure' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'CopyEntireMessage' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 602 (INTEGER)
(0x03000000:NameValue):Function = 'SqlStatementGroup::execute' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmComputeNode' (CHARACTER)
(0x03000000:NameValue):Name = 'service/EQN/transformNoticeInstructReq/transformNoticeInstructReq#FCMComposite_1_6' (CHARACTER)
(0x03000000:NameValue):Label = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq.transformNoticeInstructReq' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2488 (INTEGER)
(0x03000000:NameValue):Text = 'Error detected, rethrowing' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'service.EQN.transformNoticeInstructReq.transformNoticeInstructReq_EQN.CopyEntireMessage' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '44.3' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'SET v_blobIdOut = CAST(v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\CommonServices\ImbValue.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 664 (INTEGER)
(0x03000000:NameValue):Function = 'ImbValue::fromCharacter' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2590 (INTEGER)
(0x03000000:NameValue):Text = 'String is not of correct form for byte array. Must consist of only 0..9,a..f,A..Z' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'OLB201002241441009063411' (CHARACTER)
Please advise what I am doing wrong?
I have noticed the following:
1. If I use a HEX STRING X'30313233343536373839' that will convert to CHARATER NUMERICS 0-9 only like the code DOES NOT FAIL and will sucessfully CONVERT FORM HEX to ASCII CHARACTER NUMERICS '0123456789'
The Order of the sting does not matter as long as the it is only CHARACTER NUMERICS when converted to ASCII (0-9) AND the LENGTH of the STRING MUST BE EVEN like 10 or any other even number
2. if the length of of the Hex Sting X'303132333435363738' is an uneven number like 9 long then I will also get the error BIP2590.
3. Once I start adding Alpha CHARATERS like 'OL' and even if the string is an even length long like 24 then I will also get error BIP2590.
4. I have tried to do the conversion with CCSID set to 1208 and InputRoot.Properties.CodedCharSetId
5. I have tried to convet with BOTH CCSID and ENCODING (CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding ) and still I get the same error. |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Mar 03, 2010 1:46 am Post subject: Re: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
fatima wrote: |
Code: |
SET v_blobIdOut = CAST(v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId); |
|
Declare v_blobIdOut as a CHARACTER, not a BLOB.
fatima wrote: |
5. I have tried to convet with BOTH CCSID and ENCODING (CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) and still I get the same error. |
When CASTing between ESQL string datatypes (BIT, BLOB, CHARACTER), any ENCODING parameters are ignored. |
|
Back to top |
|
 |
fatima |
Posted: Wed Mar 03, 2010 2:11 am Post subject: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Newbie
Joined: 30 Sep 2009 Posts: 7
|
Thank You for the Reply.
I am NO longer get the Exception.
However I thought that If I do the CAST Function I will see the field displayed as 'OL2010021515032763444444' on the output Q.
Instead the field is still displayed as '4f4c32303130303231353135303332373633343434343434'
My Question is How do I display the field as CHARACTER 'OL2010021515032763444444' then? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 03, 2010 12:02 pm Post subject: Re: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rekarm01 wrote: |
fatima wrote: |
Code: |
SET v_blobIdOut = CAST(v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId); |
|
Declare v_blobIdOut as a CHARACTER, not a BLOB.
|
Or you need a go between
Code: |
DECLARE mytemp CHARACTER;
DECLARE v_blobIdOut BLOB;
SET mytemp = CAST(v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
SET v_blobIdOut = CAST (mytemp AS BLOB CCSID OutputRoot.Properties.CodedCharSetId); |
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Mar 03, 2010 10:15 pm Post subject: Re: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
fatima wrote: |
I am NO longer get the Exception.
However I thought that If I do the CAST Function I will see the field displayed as 'OL2010021515032763444444' on the output Q.
Instead the field is still displayed as '4f4c32303130303231353135303332373633343434343434' |
This code will convert BLOB to CHARACTER:
Code: |
DECLARE v_fatima BLOB X'4F4C32303130303231353135303332373633343434343434';
DECLARE v_blobIdOut CHARACTER;
SET v_blobIdOut = CAST(v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
-- 'OL2010021515032763444444' |
How does the CHARACTER string get from v_blobIdOut to the output queue? What is displaying the contents of the output queue?
Run a usertrace. Post more details. |
|
Back to top |
|
 |
fatima |
Posted: Thu Mar 04, 2010 2:13 am Post subject: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Newbie
Joined: 30 Sep 2009 Posts: 7
|
Hi Again,
Thank you for the input.
I have solved the problem
Silly Silly mistake from my side
Correct Code:
DECLARE v_fatima BLOB '4F4C32303130303231353135303332373633343434343434';
DECLARE v_Out CHARACTER '';
SET v_Out = CAST (v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.XMLNSC.Message.Type.Field1 = v_Out;
PS NOTE That I am Setting OutputRoot.XMLNSC.Message.Type.Field1 = v_Out;
v_Out has the CHARACTER STRING.
Incorrect Code:
DECLARE v_fatima BLOB '4F4C32303130303231353135303332373633343434343434';
DECLARE v_Out CHARACTER '';
SET v_Out = CAST (v_fatima AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.XMLNSC.Message.Type.Field1 = v_fatima;
PS Note that Here I am setting OutputRoot.XMLNSC.Message.Type.Field1 = v_fatima;
v_fatima has the BLOB STRING.
THANK YOU GUYS! |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Mar 04, 2010 11:23 am Post subject: Re: Convert from Hex to ASCII, throws Error Code BIP2590 |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
Thanks for posting your solution, for the benefit of others.
For future reference, please use [code] tags when posting code, to distinguish it from the surrounding text.
fatima wrote: |
Correct Code:
Code: |
DECLARE v_fatima BLOB '4F4C32303130303231353135303332373633343434343434'; |
|
One minor point here: this statement is actually assigning a CHARACTER to a BLOB, requiring an implicit CAST from CHARACTER to BLOB.
It should still work, as is, but assigning a BLOB to BLOB would be more obvious:
Code: |
DECLARE v_fatima BLOB X'4F4C32303130303231353135303332373633343434343434'; |
|
|
Back to top |
|
 |
|