|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Parsing message having EOL as delimiter |
« View previous topic :: View next topic » |
Author |
Message
|
MQEnthu |
Posted: Mon Sep 17, 2012 2:32 am Post subject: Parsing message having EOL as delimiter |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Hi,
I need to parse a incoming message that looks as below:
Message
ComplexType1
ComplexType2
ComplexType3
Complextype4
Each of these Complex types are of type fixed length and they are separated by <CR><LF>.
The problem is, there are n number of applications which send in this format and few of applications send on CR as delimiter and Not CRLF. And since we have configured <CR><LF> as delimiter in our messageset, messages will fail to get parsed when they send only CR.
I am using WMB V7 and MRM-TDS for parsing the message.
Is there any way in message set to handle this scenario. Please advise.  _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 17, 2012 3:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So you need alternative delimiters for the records. What you really need is DFDL, but you would need to upgrade to v8 in order to use it. I have a trick that I use with MRM TDS, and it should work for you.
Your current model looks like this:
Code: |
Message
complexType dataElementSeparation='Tagged Delimited' delimiter="<CR><LF>"
element name="record1" tag="R1"
complexType
element name="R1.1" length="1"
element name="R1.2" length="1"
...
element name="record2" tag="R2"
etc
|
You need to add another sequence group within the outermost complex type, like this:
Code: |
Message
complexType dataElementSeparation='Tagged Delimited' delimiter="<CR><LF>"
--> sequence dataElementSeparation='Tagged Delimited' delimiter="<CR>"
element name="record1" tag="R1"
complexType
element name="R1.1" length="1"
element name="R1.2" length="1"
...
element name="record2" tag="R2"
etc
|
If there are multiple delimiters in scope, TDS will always find the longest match, so the standard case will still work, but the <CR> scenario should also work.
Give it a try, and if it does not work, take a debug-level user trace and post the results. |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Sep 25, 2012 10:20 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Thank you Kimbert. It worked. However it did not fully solved my problem:
My message is as below:
Code: |
Message
File Header(Complextype)
Header(Complextype)
LineElements
LineElement1(Complextype)
LineElement2(Complextype)
LineElement3(Complextype)
|
And I have modeled it as below:
Code: |
Message - dataElementSeparation='Tagged Delimited' delimiter="<CR><LF>"
sequence dataElementSeparation='Tagged Delimited' delimiter="<CR>"
File Header(Complextype) - Tag = F1
LineElements (Complextype) dataElementSeparation='Tagged Delimited' delimiter="<CR><LF>"
sequence dataElementSeparation='Tagged Delimited' delimiter="<CR>"
Header(Complextype) - Tag = H1
LineElement1(Complextype) Tag=L1,
LineElement2(Complextype) Tag=L2,
LineElement3(Complextype) Tag=L3,
|
I need to have logical structure LineElements because the Line elements in group can repeat and I need to loop over the LineGroup and need generate one output for each line group. And in a LineElements group even each of LineElement1, LineElement2 can repeat.
However the above data model is not working. When delimiter is CR the inner sequence is getting repeated and not LineElements. Could you please let me know where am I going wrong.
And how do we tackle the repeating element delimiter in this case as we can not specify two repeating element delimiters
Please help. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Sep 25, 2012 10:24 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MQEnthu wrote: |
When delimiter is CR the inner sequence is getting repeated and not LineElements. |
You make the inner sequence occur exactly once. That way the only thing that can repeat is the LineElements outer sequence. |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Sep 25, 2012 10:54 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
But the Line element has delimiter and repeating element delimiter as CRLF _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
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
|
|
|
|