Newsletters Subscriptions Media Kit About Us Contact Search Home

TFH
OS/400 Edition
Volume 12, Number 15 -- April 14, 2003

Admin Alert: The OS/400 FTP Subcommand Glossary


by Joe Hertvik

FTP is a valuable TCP/IP utility because it can easily transfer files between OS/400 machines and other companion servers--including Windows, Linux, and Unix boxes--regardless of the underlying file structures that exist on each system. FTP's big downfall is that it's a command-oriented utility that has no graphical component on an iSeries or AS/400 box (not even in iSeries Operations Navigator), and it relies on FTP subcommands to transfer data.

The problem is that FTP subcommands can be obscure, confusing, misleading, ugly, and hard to understand--and those are their good points. To help you navigate through the subcommand minefield for performing FTP transfers, here's an OS/400 FTP subcommand glossary that I created for deciphering these commands.

All subcommands are shown with their full subcommand name, as well as the abbreviated subcommand name that can be used in its place (ASCII and ASC, for example). If a command needs parameters, they are shown directly after the subcommand name (LCD pathname, for example) and optional parameters are shown in brackets (HELP [subcommand name] , for example). On commands where more than one choice can be entered for a parameter, the list of possible parameters is separated by a vertical bar (|). An example is NAMEFMT 0 | 1.

Note that this is not an all-inclusive list, but it contains the commands that I find most valuable when transferring OS/400-based information. I hope it helps you successfully complete your FTP transfers. Also note that if you need to send an FTP subcommand to a remote iSeries or AS/400 server, you need to precede the command with FTP QUOTE or QUOTE SITE sub-command (see the description of the QUOTE subcommand below).

The OS/400 FTP Subcommand Glossary

ASCII or ASC (Change File Type to ASCII ): Tells FTP to copy the files in ASCII mode, meaning the data will be translated to ASCII as it's sent, if it isn't already represented in that format.

BINARY or BIN (Set Transfer Type to Image to Support Binary Image Transfer): Tells FTP to transfer the files in binary mode, meaning that the data will be copied, bit by bit, with no translation occurring as the file moves between the systems. Binary transfer is the fastest data transfer format and can be used to store unconverted OS/400 data on a non-OS/400 system.

CD Directory (Change Working Directory or Library, remote system): Changes the default working directory the FTP client session is using on the remote FTP server. If you don't specify the exact IFS or DB2 UDB location of a remote file in an FTP PUT, GET, MGET, or MPUT statement, FTP will use the CD value as the remote working directory for that file.

CLOSE host_name | IP_address (End an FTP session with the Remote System): Closes an open FTP session with a remote FTP server.

DELETE or DEL (Delete a File on a Remote System): This command allows you to delete a database file member, QDLS document, or file on a remote iSeries or AS/400 system. Depending on OS/400 version, you may be asked for authorization before the deletion occurs.

DIR (List Remote Libraries or Directories and Their Entries): Lists the files in the current working directory (CD) of the remote server.

EBCDIC (Change File Type to EBCDIC ): Tells FTP to copy the files in EBCDIC format, converting the data if it isn't already in that format.

GET remotefile [localfile] [(REPLACE] (Copy a File from a Remote System): Copies a file from the remote system to the local system. If no DB2 UDB library or IFS target file location is specified, FTP will assume the files reside in the locations specified by the CD and LCD subcommands. If no local file name is specified, FTP will copy the remote file into the local working library or folder using the same name as the remote file.

HELP [subcommand name] (Getting Help for FTP Client Subcommands): When run without a parameter, HELP displays a menu of FTP subcommands you can retrieve help text for inside an OS/400-based FTP session. When run with a specific subcommand name as a parameter (HELP PUT), it retrieves the specific help text for that subcommand.

LCD pathname (ChangeWorking Library or Folder): Changes the default working directory the FTP client session is using on the local FTP server. Like CD, FTP will use the LCD value as its DB2 UDB or IFS location when a FTP subcommand--such as PUT or GET--only specifies a local file name, without referencing its OS/400 location.

LPWD (Print Working Library, Folder, or Directory): Displays the current working library value (LCD) for the local FTP client server.

MGET remotefile [remotefile...] (Copy Multiple Files): Retrieves one or more files from your remote system to your local system. MPUT does not contain a local file value, so all files are copied to the local FTP server's working directory--as specified in the LCD FTP subcommand--with the same name as each remote file name that is retrieved. You can also use an asterisk (*) as a wildcard to retrieve all the members of a file (such as MGET QGPL/QCLSRC.* for NAMEFMT 0 transfers) or all the files in an IFS directory (for example, MGET /home/web/* for NAMEFMT 1 transfers).

MPUT localfile [localfile...] (Send Multiple Files): Sends one or more files to your remote system from the local system. MPUT does not contain a remote file value, so all files are copied to the remote FTP server's working directory--as specified in the CD FTP subcommand--with the same name as each local file sent. You can also use an asterisk (*) as a wildcard to copy all the members of a file (for example, MPUT QGPL/QCLSRC.* for NAMEFMT 0 copies) or all the files in an IFS directory (for example, MPUT /home/web/* for NAMEFMT 1 transfers).

NAMEFMT 0 | 1 (Select File Naming Format): Specifies the naming format that identifies file locations inside your FTP session. NAMEFMT 0 assumes that you're only copying files into and out of the QSYS.LIB file system using the DB2 UDB naming format of library/file.member. NAMEFMT 1 is used for identifying files in all IFS file locations, and all files or locations must be listed in IFS notation (like /home/dir, /QOpenSys/dir, /QDLS/dir, /QSYS.LIB/dir.lib/file.file). To view the current NAMEFMT values for your FTP session, type NAMEFMT or QUOTE SITE NAMEFMT without any parameters.

OPEN host_name | IP_address (Connect to FTP Server on a remote system): Initiates a request to open an FTP session with a remote FTP server.

PUT localfile [remotefile] (Copy a File): Copies a file from your client FTP system (localfile) to your remote FTP system (remotefile). File locations and names must be in the naming format specified by the NAMEFMT subcommand. The remotefile parameter is optional and--if left out of the subcommand--FTP will use the local file name as the name of the newly copied remote file and store the copied file in the location specified by the CD subcommand.

PWD (Display Current Directory or Library): Displays the current working directory value for the remote server, as specified in the CD subcommand.

QUIT (Disconnect and End an FTP Session): Disconnects the FTP client's session with the FTP host server and closes the FTP command shell. You can also press the F3 key inside the FTP shell to end an OS/400-based FTP session; OS/400 will ask for confirmation before ending a session this way.

QUOTE FTP Subcommand or QUOTE SITE FTP Subcommand (Send a Command to an FTP Server): Sends certain FTP subcommands directly to the FTP server on a remote iSeries or AS/400 server. These commands include retrieving help text on the remote server (QUOTE HELP or QUOTE HELP subcommand), changing the naming format of the remote server (QUOTE SITE NAMEFMT 1), running a CL command or program on the machine hosting the remote FTP server (QUOTE RCMD), or a number of other commands.

QUOTE RCMD OS/400 CL command | program [parameter1, parameter2, . . .parameterx] (Remote Command): Executes OS/400 commands or CL programs on a remote FTP server. This comes in handy for executing a command or program that preps your OS/400 data before you copy it via FTP. RCMD can also be used to create or clear save files [QUOTE RCMD CRTSAVF FILE(QGPL/FTPSAVE) or QUOTE RCMD CLRSAVF FILE(QGPL/FTPSAVE)] that will soon be copied to your system. Note that the RCMD subcommand is always preceded by the QUOTE literal in order to tell OS/400 to execute it on the remote FTP server. This is an OS/400-only FTP subcommand.

REINITIALIZE or REIN (Reinitialize session): Resets an FTP session with a remote server to the same state it was in when the session was started.

SUNIQUE 0 | 1 or SU 0 | 1 (Control Overwriting of Files): Tells OS/400 FTP whether it should replace or append new data to an existing file. Specifying SU 0 tells OS/400 to override existing file members, if they exist, with new data; SU 1 tells OS/400 FTP to create a new file/member with a suffix appended to the member name (if file QGPL/QCLSRC.FTP already existed when we tried to FTP a new copy to our host server, the system would create a new copy named QGPL/QCLSRC.FTP1). This is an OS/400-only FTP command.

SYSCMD OS/400 CL command | program [parameter1, parameter2, . . .parameterx] or SYSC OS/400 CL command | program [parameter1, parameter2, . . .parameterx] (Pass an AS/400 CL Command): Runs CL commands or programs from inside your local FTP client session. SYSCMD can be used to kick off commands for remote data preparation or to start a process after a remote transfer has finished. SYSCMD can also be used to create or clear save files [SYSCMD CRTSAVF FILE(QGPL/FTPSAVE) or SYSCMD CLRSAVF FILE(QGPL/FTPSAVE)] that will soon be copied to your system.

User userID [password] (Send Your User ID to the Remote System): Sends the specified user ID and the password to the remote FTP server for log on. This is a handy command to use for batch FTP.


Sponsored By
BYTWARE

Implementing security can seem like an enormous task
and many companies put it off month after month.

They may wait, but risk does not.

Fortunately protecting your data and systems from intentional or accidental loss doesn't have to take a long time. With the pre-configured filters in Bytware's StandGuard you can put a solution in place over lunch.

Get Secure.
Get StandGuard.


www.bytware.com


THIS ISSUE
SPONSORED BY:

Aldon Computer Group
ProData Computer Svcs
TAMGROUP
Bytware
Velocity
Affirmative Computer


BACK ISSUES

TABLE OF
CONTENTS
How Does the iSeries Stack Up Against Windows Servers?

IBM's Plans for Windows Server 2003 on the iSeries

IBM Introduces Autonomic Blueprint and Cure for 'Spaghetti Code'

Admin Alert: The OS/400 FTP Subcommand Glossary

Mad Dog 21/21: Oh My Darwin: Inclement Times

But Wait, There's More


Editor
Timothy Prickett Morgan

Managing Editor
Shannon Pastore

Contributing Editors:
Dan Burger
Joe Hertvik
Kevin Vandever
Shannon O'Donnell
Victor Rozek
Hesh Wiener
Alex Woodie

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com


Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.