× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Eric,
Unfortunatly, this file is being exported from a PC program and the format can
not be changed.
I will have to inform the user that when creating this file, they can not have
embedded commas in the description.

Thanks,

 
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2 
IBM  Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM  Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3

  
 






________________________________
From: "DeLong, Eric" <EDeLong@xxxxxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Fri, July 16, 2010 10:43:28 AM
Subject: RE: Parsing a CSV file with embedded commas in text field

I assume that this CSV does not use the convention to quote character data?  The
"standard" will place ""s around text data, giving you a way to safely handle
embedded commas in a description field.  However, this leads to issues with
embedded quote character in text field (ie. "DISPLAY, 24"x10", BLUE", which now
requires another workaround.  Too many compromises and workarounds, IMO.

I have sometimes tried to convert special characters into something else, ( " ->
in. ) ( ' -> ft.), but this makes the export field longer (can cause problems),
and other programs might not know that you translated the description, expecting
to see what's in the database...  More problems, difficult to find and fix...

Simple improvement<<<, use Tab Delimited instead of comma delimited.  This is a
minor variation on the standard CSV, and is supported by most platforms.  For
your issue, without quoting the text strings, this seems to address your
concerns.

XML is much better for data exchange, IMO.

-Eric DeLong
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of Jeff Young
Sent: Friday, July 16, 2010 9:00 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Parsing a CSV file with embeded commas in text field

I am using the GETTOK routine to parse records from a csv file where some of the

character fields have embedded commas.
I seem to recall that this was addressed in the past, but I do not recall how to

do it.
ex: ...,Apples, Red Delicious   88ct,nnnn,nnnn   ....

All help will be appreciated.

Thanks,


 
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2 
IBM  Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM  Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.