|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
  |
|
variable body |
View previous topic :: View next topic |
Author |
Message
|
scravr |
Posted: Fri Dec 19, 2008 5:23 am Post subject: variable body |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
I have this msg format: Header (fix length) + Body (variable length) + Trailer (fix length):
Header: fieldA, fieldB, fieldc = 50 bytes fix leng.
Body: up to 20 times of:
fieldX: 1 byte (must be “X” ) + fieldY: 50 bytes (string text - can have X char in it).
That means body can have 0, 51, 102, 153…..up to 1020 bytes.
Trailer: fieldZ 200 byes string text.
There is no indication for msg length nor for how many times body repeated.
Any ideas on how to build msg-set?
Should it be BINARY or TDS?
How to build body? As a Group and then Type on group? |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 19, 2008 5:27 am Post subject: Re: variable body |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
scravr wrote: |
There is no indication for msg length nor for how many times body repeated. |
So how, in a non-WMB sense, is the message modeled? How would a C or a COBOL program determine the number of repeats of your field Y? Is it simply (total message length - 250) divided by 51? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
scravr |
Posted: Fri Dec 19, 2008 5:55 am Post subject: variable body |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Sorry, I left this out:
If body fieldX in positions 1, 51, 102, …. contains “X”, that means this is a body fieldX+ fieldY combination. That means we need to search for “X” every 50 bytes upto 20 times.
If it is not “X” that means it’s the begging on trailer.
In other words, Trailer starts/located on first time we do not find “X” on that position. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 22, 2008 3:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi scravr,
Your message format contains tags ( the 'X's ) so you need a Tagged Delimited String ( TDS ) physical format.
Your message model should look like this ( not tested):
Code: |
Message
ComplexType DataElementSeparation="Use Data Pattern", Composition="Sequence"
Element name="Header", minOccurs="1", maxOccurs="1", Data Pattern=".*{50}"
ComplexType DataElementSeparation="Fixed Length", Composition="Sequence"
header field 1
header field 2
...
Element Name="Body", minOccurs="0", maxOccurs="20", Data Pattern="X.*{50}",
ComplexType DataElementSeparation="Fixed Length", Composition="Sequence"
body field 1
body field 2
...
Element name="Trailer", minOccurs="1", maxOccurs="1", Data Pattern=".*{200}"
ComplexType DataElementSeparation="Fixed Length", Composition="Sequence"
trailer field 1
trailer field 2
... |
If it doesn't parse successfully, apply the golden rules of parser debugging:
- disconnect the debugger
- insert a Trace node after the input node with pattern '${Root}'
- take a user trace ( debug-level ) |
|
Back to top |
|
 |
scravr |
Posted: Mon Dec 22, 2008 5:57 am Post subject: |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Looking in few test data saples, the requirement changed:
The up to 20 "X" can be either one of "X", "N", or "O".
Basicaly the body repeat TAG can be either X or N or O.
The trailer is VARIABLE LENGTH and can be 0 UP TO 200 bytes (most of times is shorter tahn 200).
When working with TDS, it requires "repeating element delimiter" ??? |
|
Back to top |
|
 |
scravr |
Posted: Mon Dec 22, 2008 5:58 am Post subject: Variable body |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Looking in few test data saples, the requirement changed:
The body 20 "X" can be either one of "X", "N", or "O".
Basicaly the body repeat "TAG" can be either X or N or O.
The trailer is VARIABLE LENGTH and can be 0 UP TO 200 bytes (most of times is shorter tahn 200).
When working with TDS, it requires "repeating element delimiter" ??? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 22, 2008 1:11 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The body 20 "X" can be either one of "X", "N", or "O". |
Just change X to [XNO] in the data pattern
Quote: |
When working with TDS, it requires "repeating element delimiter" ? |
Only if you are using delimiters. Your data is fixed-length. |
|
Back to top |
|
 |
scravr |
Posted: Tue Dec 23, 2008 5:56 am Post subject: variable body |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
I created a ComplexType as UserDataPattern, and in it:
1. ElementRefrences to present Header fields; All these global elements are UDP
2. For body, created LocalElement (in the main ComplexType) as a LocalComplexType Min/Max occurs 2/20 with UDP .{0,51} This body LocalComplexType points to GroupReference with UPD Min/Max occurs 1/1.
The group is defined as UDP with 2 local elements:
1st as string length=1, Min/Max occurs 1/1 and UDP as .
2nd as string length=50, Min/Max occurs 1/1 and UDP as .{0,50}
3. For trailer I put (in the main ComplexType) ElementRefrence Min/Max occurs 0/1 to a global element string length=200 with UDP .* (since trailer can be up to 200 bytes)
In other words, Header is fix-length (build up from few fields), body is variable length (repeat of 1+50) occurs min/max 2/20, and trailer upto 200 bytes.
When running/debugging I see the trailer data is parsed as body !!!
That means repetition of body goes beyond 20 times !!!
No data is left for trailer.
Any ideas? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 01, 2009 4:36 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
When running/debugging I see the trailer data is parsed as body !!! |
Please re-read all of my previous posts, and do what they suggest. |
|
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
|
|
|
|