Is there a way to perform AS/400 file transfers in bathc using client access? The STRPCCMD can only be run interactively, but I need a way to schedule a job to run daily which will transfer files from the AS/400 converting it to CSV format on a PC based server. I am open to any other ways to perform the file transfer if possible.
Software/Hardware used:
ASKED:
June 9, 2005 9:02 AM
UPDATED:
January 8, 2010 5:51 AM
You can also create a CL and run it in batch. Here are a couple of examples regarding CSV files using CPYTOIMPF (from http://www.as400pro.com):
========================
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)
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.
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.
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’