Passing in alternate field delimiters.

Scott Klement's tool for processing CSV files in an RPG program. http://www.scottklement.com/csv/
Post Reply
bozeyed_joe
Posts: 2
Joined: Thu Mar 16, 2023 3:11 pm

Passing in alternate field delimiters.

Post by bozeyed_joe »

Hi Scott,

We were just wondering is there a parameter that be set to use a different field delimiter on your CSVINTO parser?
We have a number of files incoming that use Pipe rather than Comma.

Many thanks in advance.
Mick
Scott Klement
Site Admin
Posts: 652
Joined: Sun Jul 04, 2021 5:12 am

Re: Passing in alternate field delimiters.

Post by Scott Klement »

Currently, no... it always uses a comma.

You can edit the CSVINTO program and change it here:

Code: Select all

      h = CSV_openBuf( parm.data: parm.dataLen: parm.dataCCSID
                     : *omit: *omit: *omit: *on );
Change it to:

Code: Select all

      h = CSV_openBuf( parm.data: parm.dataLen: parm.dataCCSID
                     : *omit: *omit: '|': *on );
Naturally you can add the ability to set that value at run-time if you want... you'll have to modify the code to make that work, it's something I've not had a need to do. If you feel that you've done a particularly nice job of it, please contribute it back to the project (post your changes here) so that others can take advantage of it.
bozeyed_joe
Posts: 2
Joined: Thu Mar 16, 2023 3:11 pm

Re: Passing in alternate field delimiters.

Post by bozeyed_joe »

Hi Scott,

Okay thanks for the pointer.
I will take a look.

Cheers
Mick
Post Reply