IBM Support

FTP Example - Transfer of an ASCII Text File

Troubleshooting


Problem

Transfering an ASCII file to/from the iSeries is described in this doc.

Resolving The Problem


  • - From iSeries 400 to remote machine



    In this example, we will show an FTP transfer of an ASCII text file from a library on one OS/400 to a remote machine (in this example, the remote machine is another OS/400).

    Do the following:

    1FTP to remote machine
    2Login to remote machine
    3Change local and remote directories to appropriate locations
    4PUT file
    5QUIT
    To FTP from the 400 to a remote machine, use the following steps:

    1From the command line, type FTP <systemname> (where <systemname> is the name assigned to the remote machine) or FTP 'xxx.xxx.xxx.xxx' (where xxx.xxx.xxx.xxx is the IP address of the remote machine).

    Note: The FTP CL command is the same as STRTCPFTP.

    The FTP command should show a screen as follows:
    Screen shot of the FTP terminal session.

    Note: In the above example, FTP loopback was used; however, FTP 127.0.0.1 produces the same results.
    2Once the FTP session is opened, you are prompted at the bottom to enter your login ID. This login ID is your user ID on the remote system rather than your local user profile name. Type your login ID, and press the Enter key.
    3You are prompted for a password. This is the password associated with the user ID on the remote system. Type your password, and press the Enter key.
    4You should now receive a prompt that looks similar to the following:
    Screen shot of the ftp terminal session after entering a userid.



    Note: You should receive a 230 <userid> logged on (this tells you that authentication was successful and you are logged onto the remote machine). In addition, you will see the type of machine you are FTPing to. (In this case, it shows: OS/400 is the remote operating system. The TCP/IP version is "V4R4M0".) In addition, the last two messages show the current naming format being used and the initial library you are logged into.
    5Next thing that needs to be done is the changing of directories on both the local (client) and remote (server) sides. To change directory on the client, use the LCD command. To change the directory on the server, use the CD command. Example: If the file is located in a library, call TEMP locally. To send it to a remote library called FILES, use the following change directory commands:

    >LCD TEMP
    >CD FILES
    6Once the change directory on both sides is complete, PUT the file across using the following command:

    PUT <filename> <replacement file name>

    Note: The <replacement file name> is optional. If none is specified, the file will keep the same name when it is PUT.

    Example: If test.txt is to be called file.txt on the remote side, do the following:

    PUT test.txt file.txt

    (The file is renamed file.txt on the remote system.)
    7After these steps are completed, a message is received indicating the transfer is complete together with some information about the number of bytes transferred and the transfer rate. It will looks like this:

    250 File transfer completed successfully.
    9 bytes transferred in 0.021 seconds. Transfer rate 0.439 KB/sec.
    8After this message is received, issue the QUIT command to exit FTP.
    • - From Windows 9x/NT to ISeries 400



      In this example, we will reverse the scenario listed above. An ASCII text file is sent from a Windows environment to OS/400.

      Do the following:

      1FTP to remote machine
      2Login to remote machine
      3Change local and remote directories to appropriate locations
      4PUT file
      5QUIT
      To FTP from DOS to OS/400, do the following:
      1From the DOS prompt, type FTP <systemname> (where <systemname> is the name assigned to the remote machine) or FTP xxx.xxx.xxx.xxx (where xxx.xxx.xxx.xxx is the IP address of the remote machine.

      The FTP command should show a screen similar to the following:

      C:\>ftp 10.1.1.1
      Connected to 10.1.1.1.
      220-QTCP at AS400.
      220 Connection will close if idle more than 5 minutes.
      User (10.1.1.1:(none)): rklarsen
      331 Enter password.
      Password:
      230 RKLARSEN logged on.
      ftp>
      2Once the FTP session is opened, you are prompted at the bottom to type your login ID. This login ID is your user ID on the remote system rather than your local user profile name. Type your login ID, and press the Enter key.
      3You are prompted for a password. This is the password associated with the user ID on the remote system. Type your password, and press the Enter key.
      4Then, change the directories on both the local (client) and remote (server) sides. To change the directory on the client side, use the LCD command. To change the directory on the server side, use the CD command.

      Example: The file is located in a folder on the C:\ called TEMP locally. To send it to a remote library called FILES, do the following change directory commands:

      ftp>LCD C:\TEMP
      ftp>CD FILES
      5Once the change directory on both sides is completed, PUT the file across using the following command:

      PUT <filename> <replacement file name>

      Note: The <replacement file name> is optional. If none is specified, the file keeps the same name when it is PUT.

      Example: For test.txt to be called file.txt on the remote side, type the following command:

      PUT test.txt file.txt

      (The file is renamed file.txt on the remote system.)
      6After these steps are completed, a message is received that the transfer was complete together with additional information about the number of bytes transferred and the transfer rate. It will looks similar to the following:

      200 PORT subcommand request successful.
      150 Sending file to member TXT in file FILE in library FILES.
      250 File transfer completed successfully.
      ftp: 7 bytes sent in 0.00Seconds 7000.00Kbytes/sec.
      ftp>
      7After this successful message is received, run the QUIT command to exit FTP.

    [{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Communications-TCP","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

    Historical Number

    21124507

    Document Information

    More support for:
    IBM i

    Software version:
    Version Independent

    Operating system(s):
    IBM i

    Document number:
    641527

    Modified date:
    18 December 2019

    UID

    nas8N1017617

    Manage My Notification Subscriptions