Sample FTP/400 File Transfers using FTPTFR Command
From Support
1.) The following example receives an ASCII text file named qrytest.txt from an FTP server to a single record AS/400 database file named TEST in library QTEMP on the AS/400.
Note: The process automatically creates file TEST during the transfer process.
Note: Namefmt 0 means the file will be placed into an AS/400 library.
FTPTFR RMTSYS('125.1.1.115') LCLFIL('QTEMP/RJSTEST') RMTFIL('/ftproot/richard/qrytest.txt') FUNCTION(GET) USR(TEST) PWD(TEST) NAMEFMT(0) FORMAT(ASCII) LOGOPT(*DSP)
2.) The following example sends an AS/400 database file named QCUSTCDT in library QIWS from the AS/400 server to a flat file named test2.txt on the remote FTP server.
Note: If there is any packed numeric data it may not get converted correctly. The FTPDBSND command is a better option for sending AS/400 database files that contain packed data.
Note: Namefmt 0 means the file will be sent from an AS/400 library.
FTPTFR RMTSYS('125.1.1.115') LCLFIL('QIWS/QCUSTCDT') RMTFIL('/ftproot/richard/test2.txt') FUNCTION(GET) USR(TEST) PWD(TEST) NAMEFMT(0) FORMAT(ASCII) LOGOPT(*DSP)
3.) The following example sends an AS/400 database file named QCUSTCDT in library QIWS from the AS/400 server to a CSV file named test3.txt on the remote FTP server.
Note: FTPDBSND requires the DataExport/400 software to be loaded on the AS/400.
FTPDBSND RMTSYS('125.1.1.115') FILE(QIWS/QCUSTCDT) RMTFIL('/ftproot/richard/test3.txt') USR(TEST) PWD(TEST) FORMAT(ASCII) LOGOPT(*DSP)
4.) The following example receives an ASCII text file named qrytest.txt from an FTP server to an ASCII IFS file named test.txt in IFS folder RJSTEST on the AS/400.
Note: Namefmt 1 means the file will be placed into an IFS folder.
FTPTFR RMTSYS('125.1.1.115') LCLFIL('/RJSTEST/TEST.TXT') RMTFIL('/ftproot/richard/qrytest.txt') FUNCTION(GET) USR(TEST) PWD(TEST) NAMEFMT(1) FORMAT(ASCII) LOGOPT(*DSP)
5.) The following example sends an IFS file named test.txt in IFS folder RJSTEST from the AS/400 server to an ASCII file named test2.txt on the remote FTP server.
Note: If there is any packed numeric data it may not get converted correctly. The FTPDBSND command is a better option for sending AS/400 database files that contain packed data.
Note: Namefmt 1 means the file will be sent from an IFS folder
FTPTFR RMTSYS('125.1.1.115') LCLFIL('/RJSTEST/TEST.TXT') RMTFIL('/ftproot/richard/test2.txt') FUNCTION(PUT) USR(TEST) PWD(TEST) NAMEFMT(1) FORMAT(ASCII) LOGOPT(*DSP)
6.) The following example sends an IFS file named test.txt in IFS folder RJSTEST from the AS/400 server to an ASCII file named test2.txt on the remote FTP server.
Note: The FTPIFSSND command is a streamlined version of FTPTFR for sending IFS files.
Note: If there is any packed numeric data it may not get converted correctly. The FTPDBSND command is a better option for sending AS/400 database files that contain packed data.
FTPIFSSND RMTSYS('125.1.1.115') IFSFILE('/RJSTEST/RJSTEST.TXT') RMTFIL('/ftproot/richard/test2.txt') USR(TEST) PWD(TEST) FORMAT(ASCII) LOGOPT(*DSP)
Categories: FTP/400 | TBPR | Knowledge Base | How To
