tags:

views:

898

answers:

3

Is there an iSeries command to export the data in a table to CSV format?

I know about the Windows utilities, but since this needs to be run automatically I need to run this from a CL program.

+1  A: 

If you want the data to be downloaded directly to a PC, you can use the "Data Transfer from iSeries" function of IBM iSeries Client Access to create a .CSV file. In the file output details dialog, set the file type to Comma Separated Variable (CSV).

You can save the transfer description to be reused later.

Chris Smith
+5  A: 

You can use CPYTOIMPF and specify the TOSTMF option to place a CSV file on the IFS. Example: CPYTOIMPF FROMFILE(DBFILE) TOSTMF('/outputfile.csv') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)

Todd Waldorf
You can also use this command with the TOFILE keyword instead of the TOSTMF keyword to load a CSV file in a library.
Paul Morgan
A: 

You could use a trigger. The iSeries Client Access software wont do since that is a windows application, what I understand is that you need the data to be exported each time that the file is written. Check this link to know more about triggers.

Gustavo Rubio