Execute FTP commands in batch on the iSeries

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.

This was first published in March 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.