Author |
Message
|
satya2481 |
Posted: Sat Oct 02, 2010 10:42 am Post subject: Message modelling for a message with Header and Data part |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi All,
I am using WMBV6.1 and need to create a message definition for below strucuture.
Code: |
RequestMessage
Header
Location (Fixed Length)
UID (Fixed Length)
Date (Fixed Length)
Data
Data (Variable Length) |
I have modeled the message set as below
Code: |
RequestMessage (Variable length elements delimited, <CR><LF> as delimiter)
Header (Fixed length) 1 - 1
Location (Char 10) 1-1
UID (Char 10) 1-1
Date (Char 8) 1-1
Data (Fixed length) 1 - 1
Data (Char 0 length) |
My requirement is just to parse header fields and the data can be anything.
I am able to receive the message and header part getting parsed. My incoming message is something like shown below
Code: |
location 123456789020101002Datadatadatadata |
Once I get the header details the message should be sent to output queue unchanged.
Here I am able to parse the header part and able to send the message to Output queue however when the message is sent to Queue its appearing as shown below
Code: |
location 123456789020101002<CR><LF>Datadatadatadata |
Since I have made the RequestMessage as VariableLengthElements delimited with <CR><LF> as delimiter its adding <CR><LF> between header and data.
Anyone know how to handle such a case, that is parse the header part and send the message unchanged to MQOutput queue, and model the message ?
Thanks in Advance
Satya _________________ IBM Certified Solution Developer WebSphere Message Broker V6.0
IBM Certified System Administrator WebSphere MQ V6.0 |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Oct 02, 2010 11:01 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There's an End Of Bitstream option.
If you don't want a delimiter, don't use a delimiter. |
|
Back to top |
|
 |
satya2481 |
Posted: Sat Oct 02, 2010 9:59 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Quote: |
There's an End Of Bitstream option |
Please let me know what are you referring here...
There's an End Of Bitstream option.
Quote: |
If you don't want a delimiter, don't use a delimiter. |
When I set "Variable Length Elements Delimited" option for the complex element then Delimiter is a mandatory option we need to set with some value.
Thank You
Satya |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Oct 03, 2010 3:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There's a CWF property that allows for a field to extend to the end of the bitstream.
It is to that which I refer.
I don't recall at the moment what the mechanism to do this in TDS is, but it should be there somewhere as well. It might just be as easy as setting length to -1.
Yes, if you tell the type that it elements in it are delimited, then you must include a delimiter and the message must be written out with a delimiter.
There is no apparent need in your message description to use a delimiter - so why are you using a delimiter?
You may also be spinning wheels of little value trying to model the full bitstream. Your header is a fixed length string which is easy enough to chop off the front of the message using SUBSTRING. |
|
Back to top |
|
 |
satya2481 |
Posted: Wed Oct 06, 2010 1:50 am Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Quote: |
There is no apparent need in your message description to use a delimiter - so why are you using a delimiter? |
You are right, there is no need of delimiter in my requirement. But as I need to model a message definition such a way that Data part should handle any number of chracters I have modelled Header and Data parts as Variable Length Elements delimited so that I need not have to specify any Length for Data Field.
I have tried to check all other options in the TDS format but no luck...
If anyone has tried such a Message modelling please get back with the details.
Thank You
Satya |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 06, 2010 2:13 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There still doesn't appear to be a specific reason for you to actually use TDS instead of CWF. The data you actually want to model seems to be purely a fixed length structure, with no delimiters or complexities. CWF is really good for this, and as I said has an option for End Of Bitstream.
There also still doesn't appear to be a specific reason for you to model the full bitstream, when you can read the message as a blob, substring off the front part, and then parse that. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 06, 2010 3:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
On RequestMessage : Change Data Element Separation to 'Tagged Fixed Length'. Set the Tag Length property to 0 and leave the Tag property empty.
On Data : Change Data Element Separation to 'All Elements Delimited'.
By doing it this way, you don't have to specify a delimited on RequestMessage, so the TDS writer won't output a delimiter between its two child elements. |
|
Back to top |
|
 |
satya2481 |
Posted: Thu Oct 07, 2010 10:02 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi Kimbert, I have tried the option you have mentioned below. But I get below error message
Quote: |
A structure must not have Data Element Separation 'AllElementsDelimited' when its parent structure has Data Element Separation 'TaggedFixedLength'. Physical format: 'TDS1'. |
Hey mqjeff,
To answer to your question. Yes I could have done the processing of the message using SUBSTRING but I am not allowed to do that, as per requirements I am asked to use MRM structure for header and data part.
May be I will try CWF physical format. Not sure though it will work or not.
Thanks for replying.
Satya |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 12, 2010 1:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - I got that wrong. But I'm fairly sure that my general approach is correct. Try these:
- set Data Element Separation to 'Variable Length Elements Delimited' instead of 'All Elements Delimited'
or
- use 'Tagged Delimited' instead of 'Tagged Fixed Length' but leave the delimiter property empty. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 12, 2010 1:29 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I guess we are assuming the text 'location' and 'data' are tags?
Otherwise, where are there tags?
Why is this not plain fixed-length messaging? |
|
Back to top |
|
 |
satya2481 |
Posted: Tue Oct 12, 2010 9:37 am Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
No, there are no tags in this message its a plain text message something like below.
TestService12345abc10Datadatadatadata
The parsed message I want to look like below...
Quote: |
Message
HeaderPart
Name = TestService
UID = 12345
SubSystem = abc
Version = 10
DataPart
Data = Datadatadatadata |
The tricky part here is DataPart.Data can be anything. Its not of fixed length. Where as HeaderPart and its elements are of fixed length.
I have to try Kimbert suggession.
- Satya |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 12, 2010 10:20 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Right, so the simplest *TDS* model possible should be to use a fixed length complex type for the header and a string element as the body, that has length = 1 and max occurs = -1.
This makes a very message message tree, in that you then have one element for each character in the body. It also probably performs poorly.
You can do other things with TDS to make a more compact message tree.
The simplest CWF model possible should be to use a fixed length complex type for the header and a string element for as the body. The string element for the body has a Length Units of End of Bitstream, and a min and max occurs of 1.
This makes a message tree that is compact, in that it only has a single instance of each element that you have actually defined and still covers the entire message bitstream.
What part of the CWF model does not match your requirements? |
|
Back to top |
|
 |
satya2481 |
Posted: Thu Oct 14, 2010 10:31 pm Post subject: |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi mqjeff,
I have remodelled my definition with CWF Physical format and the issue got resolved. Now I am not getting any characters(With TDS format I used to get delimiter <CR><LF> in between Data and Header) in between Data and Header.
Thank You
Satya |
|
Back to top |
|
 |
|