|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
ASBITSTREAM help please |
« View previous topic :: View next topic » |
Author |
Message
|
TonyD |
Posted: Sat Jun 25, 2005 5:15 am Post subject: ASBITSTREAM help please |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
In a message flow A I am trying to pass the complete input message (MQMD and MRM XML data), that was received by Flow A, as a BLOB element in a request to an application. That application will include the blob, without change, in a reply to Flow B. In Flow B I then want to recreate the returned MQMD and XML data.
I have created the BLOB as follows:
Code: |
SET Environment.Variables.EAIPayLoad = InputRoot;
DECLARE EAIPayLoad BLOB;
SET EAIPayLoad = ASBITSTREAM(Environment.Variables.EAIPayLoad
ENCODING 546
CCSID 437
SET InputRoot.Properties.MessageSet
TYPE InputRoot.Properties.MessageType
FORMAT InputRoot.Properties.MessageFormat);
SET OutputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughData = EAIPayLoad;
|
InputRoot is copied to the Environment so that I can remove some elements that do not need to be passed.
The bitstream looks OK in a trace; the MQMD and the XML data appear as I would expect expected:
Code: |
PassThroughData = '4d442020020000000000000008000000ffffffff0000000022020000520300004d5153........6e746572616374696f6e52'
|
However I am having problems recreating the original message in Flow B using:
Code: |
CREATE LASTCHILD OF Environment.Variables
PARSE(InputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughData
ENCODING 546
CCSID 437
SET InputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughParameter[1].cmdm:ParameterValue
TYPE InputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughParameter[2].cmdm:ParameterValue
FORMAT InputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughParameter[3].cmdm:ParameterValue);
|
I have tried a number of variations of the above but without success. I suspect that there is some problem with reparsing the combination of MQMD and XML but so far have not been able to work out what the PARSE parameters should be to achieve this. Does anyone know how/if I can get this to work?! |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Jun 25, 2005 8:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The InputRoot.Properties contains Encoding and CCSID fields that tell you what the data actually is. By hard coding them, you may actually be reformatting the output bitstream in ways that you don't intend.
Secondly, Environment doesn't have parsers by nature. And ASBITSTREAM doesn't carry parsers or parser associations through. So that is why you have to instruct Create Field Parse which parser to use. And it only lets you specify one, so you may have difficulty parsing data that needs more than one - like the MQMD and the Message Set TDS/CWF parser.
Thirdly, the MQMD parser is not usually part of a message set. So what you are retrieving may be attempting to start parsing your data at the first field in the MessageSet with what is actually the first set of bytes of the MQMD.
I would try asbitstreaming the MQMD separately from the body, and then concatenating them together with a marker, and then split the BLOB on that marker and then reparse it as pieces.
Or you could try adding the MQMD to your message set. It may not work, though. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
recallsunny |
Posted: Tue Jun 28, 2005 5:54 am Post subject: RE: ASBITSTREAM help please |
|
|
 Disciple
Joined: 15 Jun 2005 Posts: 163 Location: Massachusetts
|
Hi,
I've faced the same problems as you during parsing the bistream for a MRM root. However this is how I did a workaround (its not the most elegant solution, but it works for me).
Firstly create a MQRFH2 header for the root you are trying to create a bitstream and add the MCD folder to with Message set, type, format information.
Code: |
SET OutputLocalEnvironment.MyRoot.MQMD.Format = MQFMT_RF_HEADER_2;
SET OutputLocalEnvironment.MyRoot.MQMD.Version = 2;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)Version = 2;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)Format = MQFMT_STRING;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)Encoding = InputRoot.MQMD.Encoding;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)CodedCharSetId = InputRoot.MQMD.CodedCharSetId;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)Flags = 0;
SET OutputLocalEnvironment.MyRoot.MQRFH2.(MQRFH2.Field)NameValueCCSID = InputRoot.MQMD.NameValueCCSID;
SET OutputLocalEnvironment.MyRoot.MQRFH2.mcd.Msd = msgDomain;
SET OutputLocalEnvironment.MyRoot.MQRFH2.mcd.Type = msgType;
SET OutputLocalEnvironment.MyRoot.MQRFH2.mcd.Format = msgFormat;
SET bl = CAST(ASBITSTREAM(OutputLocalEnvironment.MyRoot Options options ccsid 1208) AS BLOB);
|
Now that you have included all the information needed by the parser to parse the root using the CREATE...PARSE statment, you can use default options in it to parse the root.
Code: |
DECLARE options integer BITOR(RootBitStream, ValidateContent, ValidateValue );
CREATE FIRSTCHILD of OutputRoot PARSE(MyRoot Options options ccsid 1208) ;
|
This works fine only if the Flow trying to parse the Root has a MQinput node.(I think the reason is it tries to invoke the relevant headers parser (MQMD, MQRFH2 etc) based on the Input headers.
Hope this helps!  |
|
Back to top |
|
 |
mgk |
Posted: Tue Jun 28, 2005 11:27 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
The problem is when you do this:
SET Environment.Variables.EAIPayLoad = InputRoot;
You are actually losing the parser infomation. You either need to create the parsers of the right type under EAIPayload (Using CREATE with the DOMAIN clause) for each of the parsers (MQMD, etc ) or copy to OutputRoot, then delete the bits you don't want, then ASBITSTREAM OutputRoot and then Delete the contents of OutputRoot with a
SET OutputRoot = NULL and then do the you other SET command
SET OutputRoot.MRM.cmdm:CMDMPassThroughData.cmdm:PassThroughData = EAIPayLoad;
The reason for this is OutputRoot is special in that ALL direct children of OutputRoot MUST be "Well known parser class names" (Such as MQMD, XML, MRM etc) You cannot write OutputRoot.fred for example (unless you have registered a custom parser called fred). So when you copy things to OutputRoot it will automatically create a parser of the correct type for you. This does NOT happen for any other tree, and even for OutputRoot it only happens for Direct Children under the Root of the tree. E.G.
OutputRoot.Fred will give an error.
OutputRoot.XML will be ok, an XML parser is created if it does not already exist
OutputRoot.XMLNS will be ok, an XMLNS parser created if it does not already exist
However,
OutputRoot.XMLNS.Top.XML will NOT create an XML parser under Top. an element call XML will be created, and this is a normal element.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
TonyD |
Posted: Wed Jun 29, 2005 4:02 am Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Many thanks for the informative comments.
MGK, I have come across the need to establish a parser below Environment before, in connection with some XMLNS stuff about a year ago. However since I was copying the entire message, which as you point out, contains trees belonging to two different parsers, I did not have a clue how to do it in this situation, hence the experimentation.
Currrently I am dealing with the MQMD info separately and successfully copying InputRoot.MRM to Environment.MRM using ASBITSTREAM and then extracting in the subsequent flow with a CREATE LASTCHILD OutputRoot.MRM PARSE(....
However, while acknowledging that my initial approach does not work, I am still a bit puzzled as to why not! The BLOB created by ASBITSTREAM appeared to be an MQMD, padded to full-word, followed by the XML message (however I have not translated the full 'X' string to make sure). While I can understand that reparsing XML, XMLNS or MRM from the Environment would run into problems, I cannot see why this would apply to a BLOB? In the subsequent flow, where I seek to reparse the BLOB to MQMD followed by MRM, it seems to me that I am providing all the information that an MQInput or RCD node would get, i.e. MessageSet, MessageType, MessageFormat and a 'X' string.
The Help for the CREATE statement says:
Quote: |
...All parsers support the mode RootBitStream, in which the tree creation algorithm is the same as that used by an input node...'
|
:which I was clearly interpreting over-optimistically!
Anyway, thanks everyone for the suggestions. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|