× 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 for your reply James
From what I've quickly read, that is more or less what the article that
Scott Klement alludes to in his reply


http://systeminetwork.com/article/how-read-csv-file-rpg



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



"James H. H.
Lampert"
<jamesl@touchtone To
corp.com> Midrange Systems Technical
Sent by: Discussion
midrange-l-bounce <midrange-l@xxxxxxxxxxxx>
s@xxxxxxxxxxxx cc

Subject
02/16/2010 04:52 Re: Parsing out a string
PM


Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>






Of course, it's not all that difficult to write a recursive descent
parser in ILE RPG. And in your case, it wouldn't actually need the
recursion.

Pseudocoded:

For each record
Start with the cursor at the beginning of the record, and loop:
IF the cursor is on a quote
Advance the cursor one character position
Find the first quote after the cursor position
Field is between the cursor (incl) and the quote (excl)
Advance the cursor to the closing quote
Find the first comma or EOR after the cursor position
ELSE (the cursor isn't on a quote)
Find the first comma after the cursor position
Field is between the cursor (incl) and the comma or EOR (excl)
ENDIF
IF we found a comma, instead of EOR
Advance the cursor to one character position past that comma
Continue the line loop
ENDIF
Next record


And you can even use The Cycle as your record loop.

--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.