Author |
Message
|
swadheen |
Posted: Mon Sep 27, 2004 11:39 am Post subject: Hext to Integer Conversion From Blob message |
|
|
Newbie
Joined: 17 Aug 2004 Posts: 4
|
I am getting my input message as Blob . Blob has hex value in it which tells the length of fields in blob message . I have to convert that Hex value to Integer to substring the message fields. e.g I am getting X'6600' in blob it should be converted to 102. I have tried to Cast the Substring of blob to integer but it fails to process it. Looking for help ASAP. |
|
Back to top |
|
 |
andrewl68 |
Posted: Mon Sep 27, 2004 12:44 pm Post subject: |
|
|
Novice
Joined: 23 Sep 2003 Posts: 14
|
What platform are you running this on??
X'6600' converts to a null terminated 'f' if it is ASCII.
What is the error you are getting? |
|
Back to top |
|
 |
swadheen |
Posted: Mon Sep 27, 2004 1:43 pm Post subject: |
|
|
Newbie
Joined: 17 Aug 2004 Posts: 4
|
The Broker is running in AIX env. Followg is the Code I am using
SET Environment.Variables.SEGMENT_LEN_new = cast( ls_payload_length AS INTEGER ccsid InputProperties.CodedCharSetId);
Where ls_payload_length is blob set to X'6600'
The error I am getting is ( from Trace)
Error casting a value from BLOB to INTEGER.
An error occurred when casting a value of data type BLOB to a value of data type INTEGER.
Subsequent messages will indicate the context of the error.
2004-09-27 16:41:21.937345 5147 RecoverableException BIP2456E: The value 'X'6600'' was of an unsuitable length for casting.
The operand of a casting operation was of an unsuitable length for it to be cast to the target data type. For example, BIT operands must have a length divisible by 8 when casting to BLOB. |
|
Back to top |
|
 |
kirani |
Posted: Mon Sep 27, 2004 10:17 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
What is the datatype for ls_payload_length ? What happens when you try to cast it as CHAR? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
kimbert |
Posted: Tue Sep 28, 2004 5:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have to convert that Hex value to Integer to substring the message fields |
Have you considered using MRM (CWF or TDS) to do this for you? |
|
Back to top |
|
 |
RocknRambo |
Posted: Tue Sep 28, 2004 6:11 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
wanna try this....
DECLARE ls_payload_length BLOB;
SET Environment.Variables.SEGMENT_LEN_new =
CAST( ls_payload_length AS CHAR ccsid 1208); |
|
Back to top |
|
 |
|