55 pts.
 upload to as/400
hi, my user can only use client access to upload and download file only (please assume there is only this method), is it possible for me to write a batch file to automate the upload and download. just like ftp, i can always write a script to put all the 'GET' command and trigger the FTP in CLP program. please advise. thanks

Software/Hardware used:
ASKED: July 14, 2009  1:35 AM
UPDATED: July 14, 2009  6:30 PM

Answer Wiki:
if you have a transfer created to upload or download this can be modified to go run the transfer or change the transfer name in the &strcmd on the fly and do multiple transfers. We use something similar to this with menu options to allow user to download and view/modify in Excel and/or Word and then upload modified data back to 400. I use a version to upload 7 text files and then run a program against them to create a file that gets updated only if the text files have a new creation date. Remember , this will need be modified to your current needs. <pre> PGM /* clle must be run on PC where everything is located. */ /* create directory called download on PC or specify your directory of choice. We use DOWNLOAD as a defaule so we will always know where to look for transfer STUFF */ /* create transfer to download EXCEL file to directory on PC */ DCL VAR(&STRCMD) TYPE(*CHAR) LEN(55) + VALUE('C:DOWNLOADEXCELFROM.DTF') /* or *.tto */ DCL VAR(&PCCMD) TYPE(*CHAR) LEN(55) /* run the transfer */ STRPCO PCTA(*NO) MONMSG MSGID(IWS4010) STRPCCMD PCCMD(&STRCMD) PAUSE(*NO) /*the transfer is done at this point - now */ /* if necessary change the transfer name and repeat the code. /* open the EXCEL file on the PC. if needed */ STRPCO PCTA(*NO) MONMSG MSGID(IWS4010) STRPCCMD PCCMD('START C:DOWNLOADEXCElTEST.xls') + PAUSE(*NO) ENDPGM </pre> Hope this helps BigMac
Last Wiki Answer Submitted:  July 14, 2009  1:57 pm  by  Rickmcd   1,480 pts.
All Answer Wiki Contributors:  Rickmcd   1,480 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

with client access you can use the batch transfer programs rtopcb and rfrompcb in a dos bat file.
First, create/save file transfer request. Then call it from a batch file. ie rtopcb “c:night jobswebwebparts.dtf”
use the /? switch for more parameters.

 80 pts.

 

sample of CLLE used to run a DOS batch file to do multiple transfers

             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 

transfer.bat contains
RFROMPC /F C:downloadtransfers.txt
transfers.txt contains
C:downloadstransfer1.TFR
C:downloadstransfer2.TFR
C:downloadstransfer3.TFR
C:downloadstransfer4.TFR
C:downloadstransfer5.TFR
C:downloadstransfer6.TFR
C:downloadstransfer7.TFR

call the CLLE from anywhere you can call it (menu/rpg pgm/ clle pgm)
I do believe this set up needs to interactive to work.

 1,000 pts.

 

should be DOWNLOAD transfer.bat
and downloadtransfers all occurences

 1,000 pts.

 

it is being left out on the screen but a BACKSLASH should be after the word download and downloads should be download(backslash. Also the C: backslash is missing.

 1,000 pts.