Author |
Message
|
Broker |
Posted: Mon Mar 19, 2012 12:32 pm Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Thats where is the whole problem.
If i use it as tagged delimited with outer element length of tag specified as 1,and inner length as 2, I am unable to count the number of occurances of body? I am trying it with select statement but I wanted to know if there is a way to do that directly in a message set than doing in code.
I wrote the data pattern as specified above but does not make any difference? |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Mar 20, 2012 12:08 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Does your parsing work (properly?!)? You also have a good feeling down the line (e.g. all the possible msgs that will go through your flow in production)?!
It actually happened to me that the msg-parsing would result in a sub-optimal msg-structure, so that I had to put in some pre-processing code (about 30 to 40 lines), just to get a proper structure/nesting.
You are showing a (very) good understanding of reg-exps  _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 20, 2012 3:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I must be slacking. We're on the third page of a TDS question before I get to comment.
Broker has actually described the problem quite well. It's not trivial to do this in TDS. Data patterns could do it, but I think there's a better way that will also use less CPU ( see Vitor's comment ).
Code: |
element name='Message'
complexType DataElementSeparation='TaggedDelimited' TagLength=0 Delimiter='<CR><LF>'
sequence DataElementSeparation='TaggedDelimited' TagLength=1 Delimiter='<CR><LF>'
element name='Header1' Tag='8'
element name='Header2' Tag='5'
choice DataElementSeparation='TaggedDelimited' TagLength=3 Delimiter='<LF>' minOccurs='0' maxOccurs='unbounded'
element name='Body627' Tag='627'
element name='Body637' Tag='637'
sequence DataElementSeparation='TaggedDelimited' TagLength=1 Delimiter='<CR><LF>'
element name='Trailer8' Tag='8'
element name='Trailer9' Tag='9'
element name='Trailer9' Tag='9'
complexType GroupIndicator='99' ... |
Don't assume that this will 'just work'. I have not tested it at all. If it doesn't work first time then take a debug-level user trace and see what the TDS parser is actually doing.
Note the following:
- you can use a sequence or choice group to change the length of tag mid-way through a structure
- you can use a group indicator to consume the extra two 9s in the last trailer, rather than changing the tag length ( again ). |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 20, 2012 3:03 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
oh, and I almost forgot...
It would be much easier if you were using the new DFDL parser in WMB v8  |
|
Back to top |
|
 |
Vitor |
Posted: Tue Mar 20, 2012 4:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
I must be slacking. We're on the third page of a TDS question before I get to comment.  |
I assumed you were on holiday....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Mar 20, 2012 5:20 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
And MRM does not ever allow you to construct a model that will count elements of a certain type and assign the results to a field in the model.
You must always count the elements yourself and assign the field yourself. |
|
Back to top |
|
 |
Broker |
Posted: Tue Mar 20, 2012 11:39 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Thanks a Lot everyone. I did the same way as kimbert said using sequences and group Indicators and that worked.
Thanks a lot again  |
|
Back to top |
|
 |
|