The following information was obtained via the www.iseriesnetwork.com
website. The content of which was originated by Jay Oswal who is a business systems analyst at TotalFinaElf E&P USA, Inc., in Houston, Texas. You can e-mail him at jay.oswal@TotalFinaElf.com
There is an accompanying chart of virtually all possible ftp commands to and from the AS/400. Unfortunately, being a spreadsheet it did not load well into this post and so I removed it. The information is valuable for anyone considering using ftp with an AS/400.
Before you begin, consult your AS/400 security officer and network administrators to verify that the following requirements are satisfied:
The TCP/IP network is running.
The AS/400 TCP/IP interface and FTP server are running.
AS/400 names resolve to their respective IP addresses.
Communication between your desktop PC and AS/400 and between AS/400s is active.
You have sufficient authority to the AS/400 objects you want to use in FTP processes.
To transfer files between a PC and an AS/400, open an MS-DOS command interface window (select Start, choose Run, type command, click OK) and then enter the appropriate FTP commands.
To transfer files between two AS/400s, make sure you have LMTCPB (*NO) specified in your user profile, go to any OS/400 screen that presents a command line, and enter the appropriate FTP commands from the reference chart.
Before you begin any file transfer, you must establish a connection to the remote system. For file transfers between a PC and an AS/400, I use AS400 as the value for the remote system. For file transfers between two AS/400s, I use LCL400 as the local AS/400 and RMT400 as the remote AS/400.
Once you've established a connection, you'll be prompted to type your AS/400 user name and password.
The AS/400 will automatically choose the proper NAMEFMT for an FTP session based on the syntax of the first transfer command only. Therefore, you should always explicitly specify the NAMEFMT 0 for a native file system and NAMEFMT 1 for the integrated file system (IFS) before typing the actual transfer command.
Use GET and MGET commands to transfer files from a remote system to a local system (known as downloading). Use PUT and MPUT commands to transfer files from a local system to a remote system (known as uploading). You use GET and PUT to transfer single files and MGET and MPUT to transfer multiple files.
Notice in the FTP chart the "BIN"ary mode used for transferring physical file members (PFMBR). Binary mode is a bit-by-bit transfer of data without any conversion. Considering that AS/400 physical files are likely to contain packed fields and FTP can't unpack the packed fields, there's no point in transferring an AS/400 physical file to a PC except for transferring it back to the same or another AS/400. (For more information about converting AS/400 data types, see "Convert AS/400 Data for FTP," November 1997.)
You select a particular command set over another based on file type, purpose of the file transfer, and subsequent destination of the files. For example, suppose you want to download multiple members of a source physical file (SRCPF) from an AS/400 to a PC, edit the members on the PC, and then upload them back to AS/400. To do so, you should choose the command set that includes FTP command QUOTE SITE NAMEFMT 0 before the MGET command, as Set # 3 in the reference chart shows. Be sure to review the comments in the Remarks column to help you choose the appropriate pair of FTP command sets for your task.
Jay Oswal is a business systems analyst at TotalFinaElf E&P USA, Inc., in Houston, Texas. You can e-mail him at jay.oswal@TotalFinaElf.com