I'd change the program that generates the report, to generate a file instead.

Then you could run the cpytoimpf (ibm) command against the generated file
to create the csv file in the ifs.

Here's a snip of code I use to take my generated file and make it a csv.

//-
// Build the csv file
//-
gCmd = 'CPYTOIMPF '
+ 'FROMFILE('
+ %trimr(gLib) + '/' + %trimr(gFil)
+ ') '
+ 'TOSTMF(' + apos
+ gPathFile
+ apos + ') '
+ 'STMFCODPAG(*PCASCII) '
+ 'RCDDLM(*LF) '
+ 'RMVBLANK(*BOTH)';
gMsgid = utlty_Runcmd(gCmd);

There is also a cpyftocsv command, unsure of origin but we have a copy on
our system, that does essentially the same thing but retains column/field
names in the first row. Seems like a caveat 'may' be it has trouble with
date fields. If you google cpyftocsv you may find it somewhere. I have
only used this for my personal testing, no production use that I am aware of.

Snip of code using cpyftocsv command

gDelimType = '*QUOTE'; // *NONE, *ASCII
// INCDEFN means "Field Names in First Row"

//-
// Build the csv file
//-
gCmd = 'CPYFTOCSV '
+ 'FROMFILE('
+ %trimr(gFil)
+ ') '
+ 'FROMLIB('
+ %trimr(gLib)
+ ') '
+ 'TOSTMF(' + apos
+ gPathFile
+ apos + ') '
+ 'DELIMTYPE('
+ gDelimType
+ ') '
+ 'INCDEFN(*YES) '
+ 'NUMRECS(*ALL)';
gMsgid = utlty_Runcmd(gCmd);

hth,

John B

I have a client wanting to convert several reports on a regular basis to
.csv files. I know I could write some code to do it, but the client is
wanting to know if any commercial products out there.

Thoughts, Suggestions etc?

Thanks

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