|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Tab delimited data with additional blank columns |
« View previous topic :: View next topic » |
Author |
Message
|
mhd_zabi |
Posted: Thu Nov 24, 2016 8:37 pm Post subject: Tab delimited data with additional blank columns |
|
|
Newbie
Joined: 25 Sep 2016 Posts: 7 Location: Mangalore
|
Hi Guys,
I have a message flow on IIB9 with MQ7.5 running on AIX 7.1. The input is a file for which I have created a MRM message set. I have the following message definition for the tab delimited file
ComplexOrderRequest - This is the root message tag
Data Element Separation : All Elements Delimited
Delimiter : <CR><LF>
Suppress Abset Elements Delimiter : Never
Record : This is the child of the above root message and has a cardinality of N. It has multiple fields.
Data Element Separation : All Elements Delimited
Delimiter : <HT>
Suppress Abset Elements Delimiter : End Of Type
We recieve the tab delimited file as a .txt. Since this file is sometime edited by user using excel, it might have blank lines under it. So the data can be something like below (assuming that we have only 5 fields in the record type)
Code: |
A<TAB>B<TAB>C<TAB>D<TAB>E
A<TAB>B<TAB>C<TAB>D<TAB>E
<TAB><TAB><TAB><TAB>
<TAB><TAB><TAB><TAB> |
The message definition that I have above works well with the above message but since its a user edited file, we can sometimes even get
Code: |
A<TAB>B<TAB>C<TAB>D<TAB>E<TAB><TAB><TAB><TAB>
A<TAB>B<TAB>C<TAB>D<TAB>E<TAB><TAB><TAB><TAB>
<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB>
<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB> |
As you can see we have extra tabs in this data, which causes the last field to get filled with the value "E<TAB><TAB><TAB><TAB>"
Also the last 2 blank lines throw an error as we have some mandatory fields in the message definition which it assumes are missing.
Any way to tweak the message definition so that the extra data tabs do not get added to the tree?
Thanks |
|
Back to top |
|
 |
timber |
Posted: Fri Nov 25, 2016 1:59 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
The input is a file for which I have created a MRM message set |
OK, I'll bite. Why not a DFDL model? DFDL tends to be a lot simpler to use than MRM for this type of format. If you're concerned about the learning curve then don't be; you are already struggling with the MRM parser, which does not produce any useful diagnostics outputs (except error messages). DFDL would give you a trace of every action it takes, which makes debugging your model a *lot* simpler.
Quote: |
As you can see we have extra tabs in this data, which causes the last field to get filled with the value "E<TAB><TAB><TAB><TAB>" |
Not sure why that would happen...there is a CR/LF after the 'E' so the record should end with the E and the fields on the next line should be a new record containing empty lines. Again, DFDL might do something that you didn't expect, but at least it would tell you why. |
|
Back to top |
|
 |
mhd_zabi |
Posted: Sun Nov 27, 2016 10:08 pm Post subject: |
|
|
Newbie
Joined: 25 Sep 2016 Posts: 7 Location: Mangalore
|
Hi Timber,
Yes, you are right. DFDL would have been simpler. The code was built by someone else and we currently do not have the time to redo everything again. And like you said there is a learning curve involved. We will probably get it changed sometime in future but currently we are stuck with MRM.
Regarding your point, the <CR><LF> is not immediately after E, it is after "E<TAB><TAB><TAB><TAB>", so all the tabs after E were getting added in the last field and then it goes to the next line.
Well there is a good news, i was able to solve it by adding a dummy field at the end with minoccurs as 0 and maxoccurs as unbounded. I also changed the "Suppress Absent Elements Delimiter" property to "Never" for the Record type. Seems to be working well for now. Need to get it properly tested with different scenarios.
Thanks for your response |
|
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
|
|
|
|