Return to the FTP Tips
Transfer data between an AS/400 and a PC using FTP on the AS/400 side.
The basic idea is:
OVRDBF FILE(INPUT) TOFILE(srclib/srcfile) MBR(srcmbr1) OVRDBF FILE(OUTPUT) TOFILE(srclib/srcfile) MBR(srcmbr2) FTP RMTSYS(remotesysname) DLTOVR FILE(INPUT) DLTOVR FILE(OUTPUT)Before doing this, you need to load srclib/srcfile(srcmbr1) with the FTP script for the particular file you're going to download.
userid password ASCII GET c:\temp\testfile library/file.member (REPLACE QUITOutput looks like this:
0001.00 Output redirected to a file. 0002.00 Input read from specified override file. 0003.00 Connecting to host name REMOTESYSTEMNAME at address xxx.xxx.xxx.xxx using port 21. 0004.00 220-QTCP at xxx.xxx.xxx.xxx 0005.00 220 Connection will close if idle more than 5 minutes. 0006.00 215 OS/400 is the remote operating system. The TCP/IP version is "V3R1M0". 0007.00 Enter login ID (userid): 0008.00 331 Enter password. 0009.00 230 userid logged on. 0010.00 250 Now using naming format "0". 0011.00 257 "library" is current library. 0012.00 Enter an FTP subcommand. 0013.00 > GET c:\temp\testfile library/file.member (REPLACE 0014.00 200 PORT subcommand request successful. 0015.00 150 Retrieving member MEMBER in file FILE in library LIBRARY 0016.00 250 File transfer completed successfully. 0017.00 498070 bytes transferred in 171.009 seconds. Transfer rate 2.913 KB/sec. 0018.00 Enter an FTP subcommand. 0019.00 > QUITNote that you need to have a program read the output looking for the "250 File transfer completed successfully." message to determine if it was successful.
[report a broken link by clicking here]