Author |
Message
|
Rockon |
Posted: Sat Oct 29, 2005 11:56 am Post subject: Database Insertion |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Hi All,
What m trying to do is inserting a combination of a string value with MQMD.MsgId into a database column.
Sample Result:
Hello/X'414d512041483330304430303120202042ffa1032041ac79'
Wanted result:
Hello/414d512041483330304430303120202042ffa1032041ac79
ESQL:
Quote: |
InputBody.(XML.Element)[1].ApplicationArea.Sender.Component||'/'||CAST(InputRoot.MQMD.MsgId AS CHAR) |
I tried to CAST the InputRoot.MQMD.MsgId value in different ways.I tried just putting it as InputRoot.MQMD.MsgId without casting. But fails with exception:
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/MTI/MTIforBroker/GenXmlParser2/XmlImbParser.cpp'
(0x03000000):Line = 394
(0x03000000):Function = 'XmlImbParser::parseFirstChild'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'XML Parsing Errors have occurred'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5009
(0x01000000):ParserException = (
(0x03000000):File = '/build/S500_P/src/MTI/MTIforBroker/GenXmlParser2/XmlBrokerAsgardParser.cpp'
(0x03000000):Line = 815
(0x03000000):Function = 'XmlBrokerAsgardParser::error'
(0x03000000):Type = ''
(0x03000000):Name = ''
(0x03000000):Label = ''
(0x03000000):Text = 'An error has been reported by the BIPXML4C component.'
(0x03000000):Catalog = 'BIPv500'
(0x03000000):Severity = 3
(0x03000000):Number = 5004
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '192'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = ''
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '1'
)
(0x01000000):Insert = (
(0x03000000):Type = 2
(0x03000000):Text = '587'
)
(0x01000000):Insert = (
(0x03000000):Type = 5
(0x03000000):Text = 'Invalid character (Unicode: 0x3)'
)
Any inputs would be appreciated with this regard.
Thankyou,
Cheers |
|
Back to top |
|
 |
EddieA |
Posted: Sat Oct 29, 2005 2:05 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Sample Result:
Hello/X'414d512041483330304430303120202042ffa1032041ac79'
Wanted result:
Hello/414d512041483330304430303120202042ffa1032041ac79 |
Simple. Just SUBSTRING out the part you want.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Rockon |
Posted: Sat Oct 29, 2005 3:19 pm Post subject: |
|
|
Apprentice
Joined: 24 May 2004 Posts: 43
|
Hi EddieA,
May be i dint explain it correctly.What i was looking for is the MQMD.MsgID to be inserted into the DB without it being tagged as X'<Value of MsgId>'....I just need the MsgId without it being appended by X''.What I was looking for is to insert the value to be treated as an INT.But when I CAST the MsgID as INT, the concatenated string value (||) errors out..and rightly so since m trying to concatenate <CHAR>||/||<INT>.
I hope you got my point.
Thankyou,
Cheers |
|
Back to top |
|
 |
wschutz |
Posted: Sat Oct 29, 2005 3:58 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Are you trying to conver the MsgID field from a hex value into the character representation of that value?
So,
x'01234567' would become x'3031323334353637' (char: "01234567") _________________ -wayne |
|
Back to top |
|
 |
EddieA |
Posted: Sat Oct 29, 2005 4:28 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Code: |
InputBody.(XML.Element)[1].ApplicationArea.Sender.Component||'/'||SUBSTRING(CAST(InputRoot.MQMD.MsgId AS CHAR) FROM 3 FOR 48) |
Will give you what you asked for initially.
When you get this data back, and want to convert it back to a MessageID, then all you do is CAST the 48 CHARs back to a BLOB.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|