CSV is one option.  However I've discovered that XLS is often preferred. 
It takes some hard searching but there are commands like SQL2XLS out there 
on the internet which work like this:
SQL2XLS SQLSTMT('select iprod,idesc from iim')
        TOXLS('/home/rob/ItemList.xls') 
        COLHDRS(*FLDNAM) 
        TITLE(ITEMLIST) 
http://www.mcpressonline.com/microsoft/techtip-excel-on-the-fly.html
The download link seems to be broken.  I am searching for another. 
CSV can be fraught with errors.  For example, if you try to import this 
row
2" Steel rod
from CSV into XLS it goes somewhat bonkers because Excel tries to convert 
that with quotes around it and it's an odd number of quotes now.
If you've got some programmers on staff there are some awesome 
presentations on how to do this at:
http://www.scottklement.com/presentations/#RPGHSSF
If you want to stick with CSV and you've got programmers on staff then you 
may want to look at
http://www.scottklement.com/rpg/ifs.html
There are some old deprecated commands out there:  CPYTOPCD and CPYFRMPCD. 
 Don't use those as they are limited to what directories to stick them 
into.  Basically subdirectories under QDLS.  There's performance issues 
with that file system, and who likes the old dos 8.3 file naming 
convention anyway?
I hate to mention these but there are commands CPYTOIMPF and CPYFRMIMPF. I 
personally don't like them because IBM changes them with every release and 
I have to modify the code that uses them.  Also, writing to the IFS 
directly as shown at the Scott Klement website will perform better than 
IBM's commands.  I've debugged IBM's commands and can understand why. 
That's getting a little technical for this audience.  Take this to the 
midrange-l list if you want to know more.
Rob Berendt
 
As an Amazon Associate we earn from qualifying purchases.