DPSFizz
0 pts. | Jun 9 2005 11:23AM GMT
You can also create a CL and run it in batch. Here are a couple of examples regarding CSV files using CPYTOIMPF (from <a href="http://www.as400pro.com" title="http://www.as400pro. " target="_blank">www.as400pro.com</a>):
========================
Converting EBCDIC to CSV
Try using CPYTOIMPF to put in a folder.
Something like
CPYTOIMPF FROMFILE(YourLib/YourFile) +
TOSTMF(/QDLS/YourFolder/YourPCDoc) +
RCDDLM(*CRLF) +
DTAFMT(*DLM) +
STRDLM(’”‘) +
FLDDLM(’,') +
DECPNT(*PERIOD)
This creates a CSV file in the folder. Then FTP this file.
===============================
Copy a file to an CSV file
CPYTOIMPF FROMFILE(STLIB/STATEP2) +
TOSTMF(’QDLS/TXT/STATEP2′) RCDDLM(*CRLF)
COPY OBJ(’QDLS/TXT/STATEP2′) +
TOOBJ(’QDLS/TXT/STATEP2.CSV’) +
TOCODEPAGE(*PCASCII) DTAFMT(*TEXT)
RonBender
155 pts. | Jun 28 2005 2:00PM GMT
I agree with DPSFizz, to FTP the file but you can’t get it in a CSV format on the PC server. Maybe if you FTP with the extention .CSV it will open correctly in excel.
Bigmac46
485 pts. | Oct 26 2009 2:17PM GMT
This is a way to do it interactive. It is used to allow users to select info needed and download files that have been created after they get a message the files are ready to download. The only problem we have ever had is to recreate the needed pieces when a user gets a new PC. Then we copy from my PC or another user to put it back. It may not be “UP TO DATE’ , But it will work. If uou want to you can even use rundll to open the excel after download is complete.
Hope this helps
AS400 PGM
PGM
DCL VAR(&STRCMD) TYPE(*CHAR) LEN(55) +
VALUE(’C:downloadtransfer.bat’)
DCL VAR(&PCCMD) TYPE(*CHAR) LEN(55)
STRPCO PCTA(*NO)
MONMSG MSGID(IWS4010)
STRPCCMD PCCMD(&STRCMD) PAUSE(*NO)
ENDPGM
Folder names are suggestions.
Create “download” folder on PC, then
Go to command prompt, move to “downloads” folder and edit, save, and the exit “Transfer.bat”.
Transfer.bat(contains the 1 line below
RFROMPCB /F C:downloadTRANSFERS.TXT
*******************
Then edit, save, and exit
TRANSFERS.TXT(names and path to the transfers. I save them in download folder for consistency)
c:downloadtran1.TFR
c:downloadtran2.TFR
c:downloadtran3.TFR
c:downloadtran4.TFR
c:downloadtran5.TFR
If you search there is a way to do run this from a batch job. Search RUNRMTCMD. and look for “running a PC application fron RPG. I have not tried the procedure yet because most of our application(as the one above) are on demand.
Bigmac46
485 pts. | Oct 26 2009 4:00PM GMT
the back slashes are missing after all the “c:” and the word “download”.
—- reverse the forwards in the following example(etc) . ’C:/download/transfer.bat’






