× 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.



Just a thought: If they have control over the content of that data, can they
not enclose such fields within quotes in addition to / instead of removing
commas? Why would they be able to do one but not the other?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
We have no right to ask, when sorrow comes, "why did this happen to me?"
unless we ask the same question for every joy that comes our way.
-- Philip S. Bernstein


The program that creates the csv file is a propritary PC program.
I have to deal with whatever it creates.

I have informed the user that the description can not have embedded
commas.
They load the base data from the i, so they have control of that
information.

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: Booth Martin <booth@xxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Fri, July 16, 2010 1:54:46 PM
Subject: Re: Parsing a CSV file with embeded commas in text field

Can you get the source of the csv file to put quotation marks around
all
alpha fields?  That makes your job a whole lot easier.


On 7/16/2010 10:27 AM, Alan Shore wrote:

Hi Jeff
never heard of the GETTOK routine until you mentioned it
Google found this (among others)
http://www.ibm.com/developerworks/wikis/display/webquery/GETTOK
+-+Extracting+a+Substring+(Token)

However, when I've needed to extract data from a csv file, I've used
CPYFRMIMPF
This may not be of help to you as I believe (although its not
apparent from
your request) that you want the string Apples, Red Delicious  88ct to
be
in one field
You need this to be enclosed in quotes
"Apples, Red Delicious  88ct" for this to work

It will be interesting to see if someone else has an answer for you
using
the GETTOK routine



Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill



              Jeff Young
              <cooljeff913@yaho
              o.com>
    To
              Sent by:                  rpg400-l@xxxxxxxxxxxx
              rpg400-l-
bounces@                                          cc
              midrange.com
                                                                    Su
bject
                                        Parsing a CSV file with
embeded
              07/16/2010 10:09          commas in text field
              AM


              Please respond to
                RPG programming
                on the IBM i /
                  System i
              <rpg400-l@midrang
                    e.com>






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
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.