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



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

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.