ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV Message Modelling

Post new topic  Reply to topic
 CSV Message Modelling « View previous topic :: View next topic » 
Author Message
hayder
PostPosted: Wed Apr 17, 2013 1:54 am    Post subject: CSV Message Modelling Reply with quote

Newbie

Joined: 17 Apr 2013
Posts: 2

Hi all,

I am using MB 6.1.0.11. I have a requirement to parse a csv file in my message flow. I am reading a csv file as a blob and parsing it using a defined message set through a resetContentDescriptor node. I ran into some problems with the CSV file. Below is the example of what I receive:
Header_1, Header_2, Header_3, Header_4 <CR><LF>
"a","b", "c", "d" <CR><LF>
"aa","bb","cc "hello there" cc","dd" <CR><LF>

When my message set parses this message, I get MRM parser error when it hits the 3nd line. This is because the double quotes (") the filed contains. My message Set is dealing with double quotes at the beginning and end of each field as expected. But it is getting confused when it hits the double quotes in the middle of the field. I am not that familiar with Message Sets and was hoping if someone can help me

My message Set setting:
Quote Char: "
Reserved Char: ,<CR><LF>"

Thank you
Hayder
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 17, 2013 3:10 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The TDS properties that control this are on the TDS message set.
Messaging Standard : Should be 'CSV'
Escape Character : Should be set to the empty string
Quote Character : Should be set to " ( quote character )

Info center link : http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ad09265_.htm
Back to top
View user's profile Send private message
hayder
PostPosted: Wed Apr 17, 2013 3:23 pm    Post subject: Reply with quote

Newbie

Joined: 17 Apr 2013
Posts: 2

Thank you Kimbert for your response

The Escape Char is disabled (because I am using the Quote Char)
The Qutoe char is set to " (double quote)

However, when it hits the line with the double quote within the data field, the message set throughs an exception (Parser errr exception). How Can I tell my parser to ignore the double quotes in the data field?

I am using the standard CSV message set in MB 6.1.0.11

Thank you for your help
Hayder
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Apr 18, 2013 12:23 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Ah - sorry. I should have read your first post more carefully.
If the quote character appears within the value of a field then it should be escaped. The standard way to do this is to double the quote character. Like this:
Code:
"a","b", "c", "d" <CR><LF>
"aa","bb","cc ""hello there"" cc","dd" <CR><LF>


If you cannot change the format of the incoming data then you may have to try one of the following:
a) remove the quote character. The field values will contain the leading and trailing quotes, so you will need to write a simple function to remove them
b) fix up the incoming data; double any quote characters that are not preceded by a comma or followed by a comma. You can do this by parsing in the BLOB domain, converting to CHARACTER and then using ESQL's string manipulation routines. Or Java's, if you prefer.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » CSV Message Modelling
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.