Author |
Message
|
karsusi |
Posted: Sat Dec 26, 2009 11:15 pm Post subject: using ASBITSTREAM |
|
|
 Newbie
Joined: 26 Dec 2009 Posts: 7
|
Hi,
I am using ASBITSTREAM to achieve RCD node's job. I want to get the message in BLOB format irrespective of any type message(xml,edifact etc.,).
I am using the below code. And when the message is parsed, the below code works fine. But if it is parsed then, im getting "INVALID WIRE FORMAT".
Could someone help me.
DECLARE vinCCSID INT InputProperties . CodedCharSetId;
DECLARE vinEncoding INT InputProperties . Encoding ;
DECLARE vinBitStream BLOB ASBITSTREAM ( InputRoot.MRM , vinEncoding , vinCCSID );
SET InputMsg = CAST ( vinBitStream . "BLOB" AS CHARACTER CCSID 1208 ENCODING vinEncoding );
Thanks in advance. |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Dec 27, 2009 1:16 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Have you reated a physical wire format? As you are using the MRM parser then you will need to do that.
Also, InputBody might help you here. Take a look at the docs for this and what it means.
I oten read the message as a BLOB and convert/parse it later into MRM, XMLNSC or whatever format I need. PErhaps this is a solution to your problem?
Finally, a good tip for the future would be to put the ESQL inside
tags. It really helps readability. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Sun Dec 27, 2009 4:22 am Post subject: Re: using ASBITSTREAM |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
I also dont think that you need the ."BLOB" on the vinBitStream variable:
karsusi wrote: |
SET InputMsg = CAST ( vinBitStream . "BLOB" AS CHARACTER CCSID 1208 ENCODING vinEncoding );
|
Happy to be corrected though. |
|
Back to top |
|
 |
karsusi |
Posted: Thu Dec 31, 2009 5:26 am Post subject: |
|
|
 Newbie
Joined: 26 Dec 2009 Posts: 7
|
Thanks shaman for the reply.
I achieved this by using BITSTREAM function. Earlier , I have used ASBITSTREAM to cast the parsed message to blob. But it is thrown an error since it is required propery structure. As I am parsing the message with MRM msgset, BITSTREAM is the perfect option.
Code :
SET Inputmsg = CAST(BITSTREAM(InputBody) AS CHARECTER CCSID 2208); |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 31, 2009 6:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
karsusi wrote: |
As I am parsing the message with MRM msgset, BITSTREAM is the perfect option. |
No it isn't for a number of reasons. One of which is (as shown here) that function is depreciated. Which means one day in the foreseeable future this code will stop working when it's finally removed from the product.
You were right to be using ABITSTREAM, which does everything BITSTREAM does. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Dec 31, 2009 12:45 pm Post subject: Re: using ASBITSTREAM |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
karsusi wrote: |
Code: |
SET Inputmsg = CAST(BITSTREAM(InputBody) AS CHARECTER CCSID 2208); |
|
That certainly doesn't work as-is. It's better to copy-paste directly from the ESQL when posting, to avoid introducing typos.
Vitor wrote: |
You were right to be using ASBITSTREAM, which does everything BITSTREAM does. |
I agree. Don't use BITSTREAM in new code; it's deprecated. Use ASBITSTREAM. |
|
Back to top |
|
 |
servi |
Posted: Mon Jan 04, 2010 12:21 am Post subject: |
|
|
 Novice
Joined: 19 Mar 2008 Posts: 22 Location: Madrid, España
|
It's better read InputRoot.MQMD.CodedCharSetId (or InputPropeties) CCSID, than force encoding to 1208:
DECLARE Inputmsg CHARACTER;
DECLARE bSourceText BLOB ASBITSTREAM(InputBody);
-- OPTIONS iBSoptions CCSID InputRoot.MQMD.CodedCharSetId);
SET Inputmsg = CAST(bSourceText AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId); |
|
Back to top |
|
 |
|