|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
TDS or CWF with unbounded elements |
« View previous topic :: View next topic » |
Author |
Message
|
longng |
Posted: Fri Feb 22, 2013 10:46 am Post subject: TDS or CWF with unbounded elements |
|
|
Apprentice
Joined: 22 Feb 2013 Posts: 42
|
I am currently need to deal with input data with structure represented as shown here and would appreciate your help very much of how best to deal with the challenge:
Code: |
S1
- "S1"
- vvv
- S11
+ "S11"
+ vvv
+ xxx
+ S111
* "S111"
* vvv
* vvv
* xxx
- S12
+ "S12"
+ vvv
+ xxx
+ S121
* "S121"
* vvv
* vvv
* xxx
+ S12x...
* vvv
* xxx
- S1x
+ vvv repeat the pattern shown for S11/S12 above
<EOF> or end of stream
In flat string
"S1"vvv"S11"vvvxxx"S111"vvv\vvvxxx"S12"vvvxxx"S121"vvv\vvvxxx"S1x"vvv\xxx<EOF>
S1 is the outermost structure
S11 is the 2nd level structures that can have a range from 1 to 10 (say)
S11x is the next 3rd level structures that can have a range from 1 to 20 (say)
S12 is the next 2nd level structures that can have a range from 1 to 30 (say)
S1x is the next 3rd level structures that can have a range from 1 to 40 (say)
Sxx has the same lay out as those of S11 and/or S21
Each of the structures also has its first field identifying its structure e.g. "S12" signifies it is the S12 structure.
The variable fields vvv, xxx (xxx represents many more variables) within the structures are of fixed length.
|
My first option would be to use CWF to model the message but then I realize that it would not be suitable since I cann't have unbounded elements to represent the variable range of structures, e.g. there can be 0 to 10 S111 structures.
My second option would be use TDS to model the message, yet I believe that I would need to use Tagged Fixed lenght and that would also exclude me from having unbounded elements, right?
My questions are:
1. What would be your suggestions to model the message above to support unbounded elements for any one of those nested structures or is it even possible?
2. Is this possible to use the tag of next field as a delimiter of the preceding one? E.g. field S111 ends when encounter tag S112 or tag S121 or <EOF>? Can someone please give me a quick hint? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 25, 2013 5:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I assume you are not v7. If you were on v8 you would be using DFDL.
Quote: |
My first option would be to use CWF to model the message but then I realize that it would not be suitable since I cann't have unbounded elements to represent the variable range of structures, e.g. there can be 0 to 10 S111 structures. |
Correct.
Quote: |
My second option would be use TDS to model the message, yet I believe that I would need to use Tagged Fixed lenght and that would also exclude me from having unbounded elements, right? |
No - you are thinking of 'Fixed length', which is very like CWF and does not have tags. You can have varying numbers of occurrences with Tagged Fixed Length because the tags are a reliable indication of how many actual occurrences the data contains.
Quote: |
1. What would be your suggestions to model the message above to support unbounded elements for any one of those nested structures or is it even possible? |
I would model it pretty much exactly as shown in your ( very nicely formatted ) tree view. 'S1', 'S2', 'S11' etc are the tags for each type of element.
Quote: |
2. Is this possible to use the tag of next field as a delimiter of the preceding one? E.g. field S111 ends when encounter tag S112 or tag S121 or <EOF>? Can someone please give me a quick hint? |
No, you cannot use a tag to terminate something. It is not 'terminating markup'. |
|
Back to top |
|
 |
longng |
Posted: Mon Feb 25, 2013 9:08 am Post subject: |
|
|
Apprentice
Joined: 22 Feb 2013 Posts: 42
|
Thank you very much Kimbert, I appreciate it very much that my query deserves your attention.
You are correct that we are still at V7 and may be there for some time due partly to the sheer size of our WMB environment!
In regard to using TDS Tagged Fixed Length strategy as suggest by you, I still have a bit of a concern in that it may have necessitated the need to count the length of the embedded elements (of fixed length), I may be wrong though, please comment...
Let's consider the structure S11 that has
Code: |
- S11
+ "S11"
+ vvv
+ xxx
+ S111
* "S111"
* vvv
* vvv
* xxx
+ "S1x"
* vvv
...
|
again, vvv and xxx are all fixed length element with xxx representing 0 or more fixed-length elements
The S111 can be modelled as Tagged ("S111") Fixed Length (sum of the lengths of all embedded elements, e.g. variable numbers of vvv and xxx elements within S111). I hope that I am wrong here as there would be no way to determine the sum of the lengths at design time since although the embedded elements are fixed length, their numbers are variable.
Furthermore, I still am unsure about how to model the embedded xxx fixed-length variables. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 26, 2013 4:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
As long as TDS can reasonably determine that the last repeat of vvv has occured (the last one of xxx, that is), and it can then determine that S1x has started, then TDS will be able to parse this.
It can tell that one vvv has ended becuase each vvv is fixed length, so it just grabs the necessary amount of incoming bitstream for that length.
It can then, in theory, examine the first bit of that, determine that it does not match vvv and then attempt to parse it using the next structure, which will match the tag on S1x. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 26, 2013 5:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
longng: it is possible to over-analyse things like this. I suggest that you try out some ideas, and see what happens.
Very important: you will never 'see what happens' inside the TDS parser unless you get into the habit of taking a debug-level user trace. It is quite chatty about what it is doing, and you can often see what the problem is immediately. There are posts on this forum that give the exact commands to enable, read and reset user trace. |
|
Back to top |
|
 |
longng |
Posted: Wed Feb 27, 2013 10:44 pm Post subject: |
|
|
Apprentice
Joined: 22 Feb 2013 Posts: 42
|
|
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
|
|
|
|