|
Oops...truncated a line off the command in the CL program when I copied it into the email. Try this: CPYTOIMPF FROMFILE(IFSDEVLIB/IFSTEST2) + TOSTMF('/ifsdevlib/ifstest2.csv') + MBROPT(*REPLACE) + STMFCODPAG(*PCASCII) + RCDDLM(*CRLF) Thanks, Kelly -----Original Message----- From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx]On Behalf Of Kelly Cookson Sent: Tuesday, March 09, 2004 11:06 AM To: 'COBOL Programming on the iSeries/AS400' Subject: RE: [COBOL400-L] Downloading from COBOL to a .csv Here's a CL program I wrote to test the CPYTOIMPF command. Seemed to work for me. STRPGM: PGM /********************************************************************/ /* 03/09/04 KKC */ /* THIS PROGRAM COPIES A DB2 DATABASE FILE TO A CSV */ /* FILE IN THE IFS. THE CSV FILE IS CALLED ifstest2.csv */ /* LOCATED IN THE ifsdevib FOLDER OF THE ROOT DIRECTORY */ /* IN THE IFS. THE DB2 FILE IS CALLED IFSTEST2 LOCATED */ /* IN THE IFSDEVLIB LIBRARY. */ /********************************************************************/ CPYTOIMPF FROMFILE(IFSDEVLIB/IFSTEST2) + TOSTMF('/ifsdevlib/ifstest2.csv') + MBROPT(*REPLACE) + STMFCODPAG(*PCASCII) + ENDPGM: ENDPGM ****************** End of data ************************************** Hope this helps. Thanks, Kelly -----Original Message----- From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx]On Behalf Of MichaelQuigley@xxxxxxxxxx Sent: Tuesday, March 09, 2004 9:38 AM To: cobol400-l@xxxxxxxxxxxx Subject: Re: [COBOL400-L] Downloading from COBOL to a .csv >date: Tue, 9 Mar 2004 08:04:53 -0600 >from: Kelly Cookson <KCookson@xxxxxxxxxxxx> >subject: RE: [COBOL400-L] Downloading from COBOL to a .csv . . . . . . . . . >By the way, if you don't want to write a CSV file to the IFS using COBOL, >you might try using COBOL to create a temporary DB2 database file, then use >the CL command CPYTOSTMF to write the temporary DB2 database file to an IFS >stream file. If you set the ENDLINFMT parameter to *FIXED you should get a >fixed width text file in the IFS. Microsoft Excel can open fixed width text >files. You could also try using CPYTOSTMF something like this: CPYTOIMPF FROMFILE(mylib/db2file) TOSTMF('/home/mydir/test.csv') MBROPT(*REPLACE) STMFCODPAG(*PCASCII) RCDDLM(*CRLF) This will generate a .csv file in any IFS directly from a DB2 database file. We've even put things on our IPCS or IXS (NT server -- whatever it's called now) using the /QNTC path in the IFS. Michael Quigley Systems-Analyst The Way International www.TheWay.org _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l. _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.