The ABCs of FTP

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

FTP is one of the more common TCP/IP protocols used in the computer industry today. Like its cousins, Simple Mail Transfer Protocol (SMTP) and HTTP, FTP is a common TCP/IP protocol used by a variety of systems.

FTP is not as commonly known or used in the AS/400 world as it is on other platforms, such as UNIX and Microsoft Windows NT. I can’t explain why this is, but I do know that I have used it for years and find it to be one of the most useful tools around. Using FTP, you can transfer data to and from the AS/400 with great ease. You can archive data files, libraries, or source or download data from the AS/400 to be used on another platform or another AS/400.

I personally use FTP to distribute software to the user via the Internet. To do this, I first create a save file on an AS/400. Then, I download that save file to my PC, attach a text file with installation instructions, compress the two files into a single zip file, then upload that zip file to my Web server. If you’re not familiar with zip files, or how to use them, be sure to check out the article “Zip into the Future” by Shannon O’Donnell in the October 1999 issue of MC. Once on the Web server, a user can download the zip file and use it to install my software on his AS/400. Installation and storage is actually simple, yet I find users are sometimes unfamiliar with using FTP and need a little extra assistance. This led me to conclude that quite a few AS/400 users could use information explaining how, when, and why to use FTP.

Are You Being Served?

Whenever you are going to send or receive files from a machine, the server machine requires an FTP server. An FTP server is a program running on a machine that accepts requests for connections of file transfers from another machine. The FTP server takes requests from a client, usually consisting of commands that will retrieve or send files to the server. OS/400 comes with its very own FTP server, which works rather well. The server also provides you with exit points in which you can add exit programs for added security or anonymous logon support. These exit points allow you to run certain programs before a command is run. So, your exit program that is assigned to the exit point can decide if the command should be run or not.

Think of an FTP server as a librarian. When you go to the library, you ask the librarian for a certain book and she helps you find and retrieve that book. She also takes

books from you and puts them back on the shelf when you are finished reading them. She also verifies that you can check out books by issuing you a library card—the same way an FTP server normally requires a user ID and password. In the same sense, an FTP server acts as a librarian for your data.

Making the Connection

The AS/400, as do most server machines, comes equipped with an FTP server. Starting the FTP server requires you to use the START TCPIP SERVER (STRTCPSVR) command, specifying *FTP for the server name. The command is as follows:


You can verify if your FTP server is running by viewing active jobs that start with QTFTP. Using the command WRKACTJOB JOB(QTFTP*) will display, if active, the jobs running for the FTP server.

Once the FTP server is running on the AS/400, it is ready to accept communications and file transfers from a client. An FTP session is initiated by a user issuing an FTP connect command from his client machine, specifying the remote machine as the target. From your PC, you can start an FTP session by clicking the Start button, selecting the Run option, then entering FTP in the command prompt. These steps should bring up an FTP session in a DOS window. To initiate the connection, use the command OPEN followed by the IP address of your AS/400. If your FTP server is running on your AS/400, you should receive a prompt that asks you for your user ID, as shown in Figure 1 (page 54). Here you will enter your AS/400 user ID. After you have entered your user ID, you will be prompted for a password. Again, this is probably the same password you use to log on to the AS/400 in most other situations.

You can also start an FTP session from your AS/400 by using the FTP command. The FTP command accepts an IP address or domain name as a parameter, and this tells the FTP client where to establish an FTP connection. Just remember that your FTP server does not need to be running on your AS/400 to start an FTP session on the same AS/400. This is because the FTP command starts a client job requesting a connection with a machine running an FTP server.

Common Commands

Once you are logged on, it is a good idea to use the HELP command. This will show you all the commands available for you to use. You can see an example of the HELP command in Figure 2. In addition to the HELP command, you can use the REMOTEHELP command on most systems. This command will show you what commands the server allows.

Of the commands available, there are a few that are more commonly used. These commands are shown in Figure 3. Most of the commands are self-explanatory. The GET and PUT commands are used most frequently, since the purpose of FTP is to send or retrieve files to or from a remote machine, respectively. The CHANGE DIRECTORY (CD) and LOCAL CHANGE DIRECTORY (LCD) commands can be used to position where a file will be retrieved from or put to, depending on the command being used. CD changes the current directory on the server machine, and LCD changes the current directory on the local, or client, machine. As with the CD command, some commands are similar to DOS commands—the DIR command, which lists the contents of a directory, comes to mind.

Which File System?

As you may know, the AS/400 contains a couple of unique types of file systems. These are commonly known as the QSYS file system and the ROOT file system—both of which are contained within the AS/400 Integrated File System (AS/400 IFS).

AS/400 users know the QSYS file system as the library file system. All libraries on the AS/400 are contained within a single library known as QSYS. These libraries hold your files, source members, and programs. The ROOT file system is more common to a PC file system, containing directories, subdirectories, and files.

Using FTP with each of these systems is different. Setting up FTP to use each of these systems also requires a couple of special commands. The FTP Name Format (NAMFMT) command tells the AS/400 FTP server which file system you will be making requests from. For example, the following command tells the AS/400 that you wish to retrieve files using the ROOT file system naming structure, similar to running an FTP session on a PC:


The filenames are specified in the format /directory1/directory2/.../filename. On the flip side, this command tells the AS/400 that you are going to use the library method of FTP communications:


You’ll notice the use of the QUOTE SITE commands in the previous examples. The reason for this is the NAMEFMT command is an AS/400 command. To run a command on the AS/400 from the PC FTP client, use the QUOTE command to say “run this command on the server.” If you were using the AS/400 as a client, you would omit the QUOTE SITE portion of the command.

You can use the CD command to change which library you are currently using. Then, for retrieving files, you use the format [lib/]filename[.member] to tell the AS/400 which file to retrieve by using the GET command, or what to name the file when it gets there by using the PUT command. The library name is optional, and, if not used, the current library will be used. If a member name is not specified following the file name, the member name will be assumed to be the same as the file name.

Files in libraries can be accessed not only in NAME FORMAT 0 but also in NAME FORMAT 1. The format used is as follows:


Basically, all you need to remember is to always start with /QSYS.LIB, then add the name, followed by a period and the appropriate attribute found on a WORK WITH OBJECT (WRKOBJ) command, minus the leading asterisk.

One oddity that I have found is, if I am using NAME FORMAT 1 and wish to switch to NAME FORMAT 0, I must first change the directory to /QSYS.LIB and then issue the command to change to NAME FORMAT 0.

Watch the Mode!

The transfer format of the data may also be important when transferring files with FTP. There are normally two modes of file transfer. The first is ASCII, in which the file is downloaded as an ASCII file. This is mainly used for uploading or downloading source members so the source members are treated as text files. The AS/400 FTP server handles the EBCDIC-to-ASCII translation by using tables that are available on the system. The table used can be changed with the CHANGE FTP ATTRIBUTES (CHGFTPA) command and by specifying a new table on the TBLFTPOUT or TBLFTPIN parameters. There is a table for both input and output, so changing the correct one will make a difference. Using the FTP command ASCII on the FTP command line will tell the server to transfer the file in ASCII mode.

The second mode of transfer is binary. This format is usually used for uploading or downloading save files or any other type of file or object that you don’t want corrupted by the conversion from EBCDIC to ASCII. Image files stored in the AS/400 IFS are good examples of this type of file. Entering the command BINARY, or BIN, on the FTP command line will tell the server to send the file in binary mode. One nice thing about the AS/400 is that, if you try to upload or download a save file in ASCII mode, it will actually give you an error message telling you that binary mode is required for save files.

One thing to note when using FTP to transfer data files to your PC is, if the file contains numeric data, the numeric data will not be translated correctly. Files that contain only character data, however, are transferred without any problems. If you wish to transfer a file from your AS/400 to your PC to be used in another database, it is best to first copy the physical file into a comma-delimited file, then FTP the result. This can be done using the COPY TO IMPORT FILE (CPYTOIMPF) command.

FTP Tricks

Once you’ve used FTP long enough to feel comfortable with it, you can start using some tricks to make your job easier. In the August issue of Midrange Computing, there is an article titled “FTP: Tricks of the Transfer,” which will help you with these tricks. Tricks such as creating dynamic FTP scripts, downloading multiple files at once, and even downloading source from your AS/400 are included in this article.

FTP may be new to some people, but it’s definitely one of the easier TCP/IP protocols to use, and it is one of the most beneficial.


• ”FTP: Tricks of the Transfer,” Bradley V. Stone, MC, August 2000
• OS/400 TCP/IP Configuration and Reference V4R4 (SC41-5420-03, QB3ANL03)
• ”Zip into the Future,” Shannon O’Donnell, MC, October 1999

ftp> open
Connected to
220-QTCP at
220 Connection will close if idle more than 10 minutes.
User ( ftp> help
Commands may be abbreviated. Commands are the following:

! delete literal prompt send
? debug ls put status
append dir mdelete pwd trace
ascii disconnect mdir quit type
bell get mget quote user
binary glob mkdir recv verbose
bye hash mls remotehelp
cd help mput rename
close lcd open rmdir

Figure 1: This is an example initial prompt for an FTP connection.

Figure 2: Issuing the HELP command once you’re signed onto an FTP server returns the commands available to you.

Command Action

OPEN Open a connection to an FTP server CLOSE Close a connection to an FTP server QUIT Close a connection to an FTP server and exit the FTP client program
GET Get a file from the FTP server
PUT Put a file to the FTP server
DIR List the current directory contents
CD Change the current directory
LCD Change the current directory on the local machine HELP Display a list of available commands

Figure 3: The most commonly used FTP commands are self-explanatory.



Support MC Press Online





  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things

    Read Node.js for Enterprise IBM i Modernization Now!


  • Profound Logic Solution Guide

    SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation.
    Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects.
    The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the companyare not aligned with the current IT environment.

    Get your copy of this important guide today!


  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.


  • Progressive Web Apps: Create a Universal Experience Across All Devices

    LANSAProgressive Web Apps allow you to reach anyone, anywhere, and on any device with a single unified codebase. This means that your applications—regardless of browser, device, or platform—instantly become more reliable and consistent. They are the present and future of application development, and more and more businesses are catching on.
    Download this whitepaper and learn:

    • How PWAs support fast application development and streamline DevOps
    • How to give your business a competitive edge using PWAs
    • What makes progressive web apps so versatile, both online and offline



  • The Power of Coding in a Low-Code Solution

    LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Why Migrate When You Can Modernize?

    LANSABusiness users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.


  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact


  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using as a pre-built development environment



  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.



  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.



  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails


  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.



  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Node Webinar Series Pt. 1: The World of Node.js on IBM i

    SB Profound WC GenericHave you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.
    Part 1 will teach you what Node.js is, why it's a great option for IBM i shops, and how to take advantage of the ecosystem surrounding Node.
    In addition to background information, our Director of Product Development Scott Klement will demonstrate applications that take advantage of the Node Package Manager (npm).
    Watch Now.

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY the one package that solves all your document design and printing challenges on all your platforms.

    Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. How can you be sure you won’t miss important system events?
    Automate your message center with the Robot Message Management Solution. Key features include:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing.
    Manage your reports with the Robot Report Management Solution. Key features include:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.