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