Problem solve Get help with specific problems with your technologies, process and projects.

Execute FTP commands in batch on the iSeries

Follow these steps from Search400 member Tim Brinker to execute batch jobs.

On the AS/400 create a flat physical file. This file will contain the User ID and Password to sign for the system, the FTP command will be executed. This file will also contain the FTP commands (PUT, GET..).

Example Flat File Containing the FTP Commands

   put Library/File Library/File 

Replace the USERID and PASSWORD in the example file with a valid User ID and Password for the system the FTP will be executing to.

Now to execute the FTP file defined above in a batch job, you need to override the file created above to a file name of INPUT. Then all you need to do is execute FTP with the System Name or IP Address.

Example CL Commands to Execute the FTP

            FTP        RMTSYS('')                   
            DLTOVR     FILE(*ALL)

You can also automate FTP commands from the PC. To do this you need again to create a script (text) file on the PC that contains the FTP commands you wish to execute.

Example PC Text File of FTP commands

  open         {IP Address of the system you wish to connect to}
  USERID                   {User ID for the System You Will Connect to}
  PASSWORD                 {Password of the System you Will Connet to)
  get /qsys.lib/temp.lib/temp.file/qtemp.mbr e:qtemp

Now to execute the FTP command to transfer files from the another system to your PC do the following.

Start the MS DOS Prompt and at the DOS prompt enter the following

replace FILENAME with the name that you saved the text file as.

Note: My FTP scripts have "binary" in them. You use binary when you wish to transfer AS/400 Save files between systems.

Dig Deeper on FTP