Author |
Message
|
mqlover |
Posted: Thu Oct 11, 2012 6:47 pm Post subject: Prepending the Header to incoming BLOB message |
|
|
Disciple
Joined: 25 Jul 2010 Posts: 176
|
Hi,
I have a fixed message incoming and I consider it as a BLOB. I need to construct a header which is readable when I send it downstream. I constructed a header called as OuptutRoot.MRM.Header.
I need to prepend this header to the incoming message ans send it downstream.
I tried it like this but this is not working
SET Request = InputRoot.BLOB.BLOB;
SET OutputRoot.BLOB.BLOB = OutputRoot.MRM.Header || Request;
This is not working. How do I pass the message to downstream such that only header is readable . Could anyone suggest how to do this.
Thanks |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Oct 11, 2012 7:57 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
How about using XML as the output data format
create a simple schema and make the BLOB an element with the one of the binary types available in an XSD.
Make sure you use the right binary type though, there are two.
I've used this for data coming from a Traffic Camera. The Picture was an encrypted blob and all the time, place etc was in XML. _________________ 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 |
|
 |
mqlover |
Posted: Thu Oct 11, 2012 8:44 pm Post subject: Prepending the Header to incoming BLOB message |
|
|
Disciple
Joined: 25 Jul 2010 Posts: 176
|
Hi,
Thanks for your suggestion.
I just added another field in my Message set and copied the incoming message to it.
I used MRM format only as we were not supposed to use ESQL.
But just before going to the O/p queue it is giving BIP5136 i.e Invalid wire format. I do not understand where its going wrong.
I know that if MRM message not wired properly then we get such error.
Still am not getting where am going wrong.
Thanks |
|
Back to top |
|
 |
NealM |
Posted: Thu Oct 11, 2012 8:58 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
A BLOB is just data that you don't know, or want to know, enough about to assign it into a parsed structure of some sort in the Broker. But since the Broker handles data of various CCSIDs and wants to leave it unchanged, it works with the hexadecimal representation of data of unknown type and calls that a BLOB. If just concatenating some more data on the front of a BLOB will satisfy your needs, then you had the right idea, however you cannot concatenate two different types of data, whether it be char to integer or char to BLOB or parsed XML/MRM to BLOB.
You need to bitstream your little MRM into a BLOB of its own, and concatenate that BLOB to the front of your incoming message.
And besides that, can I assume you left out the steps of actually putting your MRM structure into OutputRoot for brevity? (It would be wrong anyway) |
|
Back to top |
|
 |
mqlover |
Posted: Thu Oct 11, 2012 11:29 pm Post subject: Prepending the Header to incoming BLOB message |
|
|
Disciple
Joined: 25 Jul 2010 Posts: 176
|
Hi,
Thanks for your suggestion.
I just converted like :
DECLARE input BLOB;
SET input = InputRoot.BLOB.BLOB;
SET OuptuRoot.MRM.Body = BITSTREAM(input);
But here when am doing BITSTREAM my BLOB input, am getting 5136 error which means invalid wire format.
Could you please suggest why is it happening so.
Thanks |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Oct 12, 2012 12:26 am Post subject: Re: Prepending the Header to incoming BLOB message |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mqlover wrote: |
I used MRM format only as we were not supposed to use ESQL.
|
Can you please enlighten us as to the really critical reason your site has this rule in place?
Don't you realise that ESQL is a key component of Broker and by not allowing it's use you are really discaring a good part of a very expensive product.
If is is because you are a Java shop then even the most hardened java fans do recognise that some things are just better done in ESQL. _________________ 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 |
|
 |
mqlover |
Posted: Fri Oct 12, 2012 12:55 am Post subject: Prepending the Header to incoming BLOB message |
|
|
Disciple
Joined: 25 Jul 2010 Posts: 176
|
Hi,
My bad..Am extremely sorry for writing something wrong and making you all waste time on it.
I wanted to tell that we are supposed to use MRM format than using XML format.
Apologies. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Oct 12, 2012 6:28 am Post subject: Re: Prepending the Header to incoming BLOB message |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqlover wrote: |
Could you please suggest why is it happening so. |
Because you didn't read the description of the BITSTREAM function properly (or at all):
Quote: |
Its use is deprecated; use the newer ASBITSTREAM function instead. |
and specifically:
Quote: |
The BITSTREAM function can be used only on a tree produced by a parser belonging to an input node. |
A BLOB variable is not a tree produced by an input node.
But fortunately:
Quote: |
The ASBITSTREAM function does not suffer from this limitation |
_________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Oct 12, 2012 6:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Okay, if you are trying to turn a TREE into a BITSTREAM, you use ASBITSTREAM.
If you are trying to turn a BITSTREAM into a TREE, you use CREATE FIELD... PARSE...
If you already have an MRM message tree that you want to add additional data to the "front of", you should simply create a new message model that includes an additional field at the front, then you don't have to do anything to parse or serialize the tree, you just work with it as a logical message tree and let broker handle it. |
|
Back to top |
|
 |
NealM |
Posted: Fri Oct 12, 2012 6:34 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Also, read up on ASBITSTREAM before blindly plugging it in. I talked about CCSIDs above for a reason. The header you are adding should be bitstreamed into the same CCSID as the input BLOB before you concatenate the two or the resulting BLOB could end up being a disaster. There are examples in the infocenter. |
|
Back to top |
|
 |
|