Ability to perform AS/400 file transfers in batch
0 pts.
0
Q:
Ability to perform AS/400 file transfers in batch
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.
ASKED: Jun 9 2005  9:02 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
7305 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
STRPCCMD only interactive?
Check for STRPCO in this forum. (only CA)
Or you can run a RFROMPCB(RTOPCB) in a .bat file?

====================================================

There should be no need for STRPCCMD ever. The AS/400 and Windows/Linux PCs can share directories through Windows networking. you don't need to transfer a file when a file can be directly accessed through a network shared directory. Just put your file into a shared IFS directory (possibly into a /QNTC directory) and the PC that needs it can just map a drive to the same directory. Or the PC can simply use a UNC path ( \\ComputerName\SharedFolder\Resource ) and not map a drive at all.

Forget STRPCCMD (except in some very particular circumstances). It's effectively obsolete and appropriate for DOS Client Access. You probably won't ever use such a PC again. Learn the technologies that are appropriate today.

Tom
Last Answered: Oct 26 2009  5:04 AM GMT by TomLiotta   7305 pts.
Latest Contributors: hahajokes   5 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

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’

 
0