Author |
Message
|
j.f.sorge |
Posted: Mon Dec 22, 2008 7:09 am Post subject: [solved] Modelling MessageDefinition with variable length |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
Hi!
I want to model a message definition which parses messages with variable length. All optional elements which are blank at the end of the message are cut by the writing HOST programm.
When I try to parse this message with a definition of optional elements there is always an error that the bit-stream is short than expected length.
My work-around is to fill the message with spaces before I apply the definition.
Is there any chance to model such a definition?
Thanks in advance! _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Last edited by j.f.sorge on Tue Jan 06, 2009 6:04 am; edited 1 time in total |
|
Back to top |
|
 |
scravr |
Posted: Mon Dec 22, 2008 7:15 am Post subject: Modelling MessageDefinition for message with variable length |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Define it with TDS and put <CR><LF> (or other char) as a delimiter. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Mon Dec 22, 2008 7:18 am Post subject: Re: Modelling MessageDefinition for message with variable le |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
scravr wrote: |
Define it with TDS and put <CR><LF> (or other char) as a delimiter. |
And if there is no delimiter at all? _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
scravr |
Posted: Mon Dec 22, 2008 7:26 am Post subject: Modelling MessageDefinition for message with variable length |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
your msg must end with something !
if not, put <CR><LF> (or \n) as default. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Mon Dec 22, 2008 7:34 am Post subject: Re: Modelling MessageDefinition for message with variable le |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
scravr wrote: |
your msg must end with something !
if not, put <CR><LF> (or \n) as default. |
Okay - I could append an delimiter to my message before applying the definition.
I have to try if this works for a definition like where (M) stands for mandatory fields and (O) for optional ones:
(M)Data1(M)Data0(O)Data2(O)Data3(O)Data4<CR><LF> _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Dec 22, 2008 8:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If there is no delimiter, then you must use Data Patterns. In some cases you can use Tags instead. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 22, 2008 2:03 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Is there any chance to model such a definition? |
Yes, and the facts are:
- If you are using v6.0 or v6.1, both CWF and TDS can handle trailing optional data
- Your description of your message format is nowhere near enough to answer your question. You have not stated whether your fields are tagged or non-tagged, delimited or fixed length. You should supply at least one complete example. Several examples are often useful for complex formats.
- It is definitely possible to parse your input message using data element separation of 'Use Data Pattern'. Depending on the details of your actual format, you may be able to do something more efficient than that.
Quote: |
My work-around is to fill the message with spaces before I apply the definition |
Ugh! MRM can do better than that for you
scravr: Your comment implies that the MRM parser cannot handle this scenario. Please don't advise users to change their input message unless you are 100% certain that they need to. Otherwise future readers of this thread may get the wrong idea. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Tue Dec 23, 2008 12:53 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
- If you are using v6.0 or v6.1, both CWF and TDS can handle trailing optional data |
We are using WMB 6.0.0.3
kimbert wrote: |
- Your description of your message format is nowhere near enough to answer your question. You have not stated whether your fields are tagged or non-tagged, delimited or fixed length. You should supply at least one complete example. Several examples are often useful for complex formats. |
I have a HOST format with fixed length elements. Will try to get some examples but need to contact a collegue. _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
scravr |
Posted: Tue Dec 23, 2008 5:15 am Post subject: Modelling MessageDefinition for message with variable length |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Kimbert:
I think you should read the thread from top again.
How/Where do you see my “comment implies that the MRM parser cannot handle this scenario.”
And where in my comments do you see me “advise users to change their input message” ???
And if someone suggested these approaches, yes you are right, he/she are wrong.
Moshe |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 01, 2009 4:49 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi scravr,
Apologies. When you said:
Quote: |
your msg must end with something ! |
I thought you were advising j.f.sorge to make sure that his message ended with something. You must admist that it was a reasonable assumption, because j.f.sorge had just said
Quote: |
And if there is no delimiter at all? |
which implied to me that his message does not end with anything. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 01, 2009 4:51 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
j.f.sorge: Have you set maxOccurs to -1 on the final top-level child of the message? |
|
Back to top |
|
 |
j.f.sorge |
Posted: Fri Jan 02, 2009 1:16 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
j.f.sorge: Have you set maxOccurs to -1 on the final top-level child of the message? |
Sorry, but I cannot find the information so I have to wait until my collegue is back from his holiday. _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
j.f.sorge |
Posted: Mon Jan 05, 2009 2:40 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
j.f.sorge wrote: |
kimbert wrote: |
j.f.sorge: Have you set maxOccurs to -1 on the final top-level child of the message? |
Sorry, but I cannot find the information so I have to wait until my collegue is back from his holiday. |
I asked my colleagues and they told me how the message is cut. All trailing data which are SPACE are cut by the HOST program which puts the messages to the queue. Data is although cut if there are mandatory fields. Can you define such a message definition? _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jan 05, 2009 3:46 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Both CWF and TDS can handle a situation where a structure repeats an unknown number of times. However, it sounds as if your scenario is a little different. Your source application is truncating a structure.
It may still be possible to handle your message definition using TDS if
- Your message does not use CWF-specific physical types. In v6.0, TDS supports only character data.
- Your data does not require CWF-specfic features such as byte alignment for structures and fields
So your options are:
a) if possible, use TDS with Use Data Pattern.
b) Continue to pad the message with spaces, and use TDS with Fixed Length or CWF.
Bear in mind that b) may be faster than a), and is certainly simpler to maintain. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Tue Jan 06, 2009 6:03 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
Bear in mind that b) may be faster than a), and is certainly simpler to maintain. |
Thanks a lot for the help! I have implemented one SubFlow which can appends spaces to an incoming message's BLOB. _________________ IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|