Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

FTP from AS400 to other server

I want to be able to use the FTP command on the AS/400 (V4R5) to transfer files from our AS400 to another server (unknown type at present) and when done, to retrieve a file from the other server. This process has to be automated so it can recur every 5 minutes. The file transfers will only occur if the files have changed.

How can I do this?
WebSphere is NOT an option.
0
bhlang
Asked:
bhlang
  • 3
  • 2
1 Solution
 
theo kouwenhovenCommented:
Start ftp by running the FTP command, followed by the other server name or IP address.
This IP address must be quoted with single quotes:

e.g. FTP '155.30.64.12'

To automate this, you can define a input file for the commands and outputfile for the log.

(use OVRDBF for this)

The inputfile can hold all the ftp commands you need.

If you like an example of the input-file or CL or both please let me know.

cheers
0
 
bhlangAuthor Commented:
An example of both would be great!
0
 
theo kouwenhovenCommented:
Will send it first thing in the morning CET
0
 
theo kouwenhovenCommented:
OK the CL

/* Execute FTP Commands */
             OVRDBF     FILE(INPUT) TOFILE(FTPINP) MBR(SNDDEF)
             OVRDBF     FILE(OUTPUT) TOFILE(FTPOUT) MBR(LOGTXT)  
             STRTCPFTP  RMTSYS(*NONE)                          
             DLTOVR     FILE(*ALL)                              

The FTPINP and FTPOUT files are Sourcefiles

(contents of a FTPINP member)

OPEN 123.123.123.123                    
USER myuserid mypassword
LOCSIte Trim 0                      
CD /mypcdir
LCD /my400lib                        
PUT my400file mypcfile.tmp
REN mypcfile.tmp my400file.txt
CLOSE                                
QUIT                          


I do the rename because the destination server is running a proccess every 5 minutes that will process all *.txt files. If the FTP PUT command is interrupted the remote process can not process a incomplete file.

The "LOCSIte Trim 0" will send the file as it is on the 400, if you don't specifie this the trailing blanks of each transfered record will be striped.

Have fun!!!
0
 
bhlangAuthor Commented:
Thank you. Your answer did exactly as I needed.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now