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 mailing list archive is Copyright 1997-2025 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.