Newsletters Subscriptions Media Kit About Us Contact Search Home

TFH
OS/400 Edition
Volume 12, Number 18 -- May 5, 2003

Admin Alert: Copying IFS Files from One iSeries to Another


by Joe Hertvik

In OS/400 shops with multiple iSeries and AS/400 machines, there's always a need to copy Integrated File System, or IFS, data between machines. And as OS/400 continues to host more stream-file-based applications, like IBM Lotus Domino and WebSphere, that need becomes more important, but a standard file transfer utility like FTP can make your transfers easier.

Copying stream file data between two iSeries or AS/400 boxes is a fairly simple procedure that. I'll present a simple example in which an index.htm file is transferred between the /home/ftp directory of one iSeries server (called ftpsrv400, in a domain named dummydomain.com) to the /home/ftp directory of an AS/400 machine (called ftpcln40, which also resides in dummydomain.com). [Note: To reproduce these examples in your own environment, change the machine and IFS directory names to match that of your OS/400-based servers].

First, start your iSeries FTP servers. You do this by using the Start TCP/IP Server (STRTCPSVR) command, specifying *FTP in the Server application (SERVER) parameter, as follows:

STRTCPSVR SERVER(*FTP)

Your FTP servers can also be started by using iSeries Operations Navigator.

Now use the AS/400 server named ftpcln400 (the FTP client machine) to initiate an FTP session with the ftpsrv400 iSeries server (the FTP server machine) by using the FTP green-screen command on ftpcln400, as follows:

FTP RMTSYS(ftpsrv400.dummydomain.com)

This command will open an FTP session with the ftpsrv400 server. You could also open that session by using the ftpsrv400 server's short name, if there's an entry in a corresponding DNS server or the iSeries' host table. Another option for opening the session would be to use the remote server's IP address. To perform either of these functions, use one of the following FTP command variants:

FTP RMTSYS(ftpsrv400)

Or

FTP RMTSYS(*INTNETADR) IPADDR('192.1.1.1')

To perform the file transfer, execute the following FTP subcommand script from inside the FTP shell:

NAMEFMT 1
CD /home/ftp
LCD /home/ftp
ASCII
PUT index.htm  index.htm
QUIT

For a complete description of FTP subcommands, see "Admin Alert: The OS/400 FTP Subcommand Glossary." Here's how the different FTP subcommands work out in my example.

  • NAMEFMT 1: Specifies that this file will be copied from an OS/400 IFS location, rather than from a native DB2 UDB library. Using NAMEFMT 1 mandates that all OS/400 path names be coded in IFS notation beginning with the root directory notation (/), followed by the rest of the IFS path to that object. The file syntax for IFS notation is /filesystemname/directoryname/filename.extension for files in the root (/), QDLS, and QOpenSys file systems. OS/400 sometimes automatically changes the NAMEFMT variable to 1 when it sees an IFS path name but in my experience it's always better to explicitly state NAMEFMT 1 in your script, because it changes the NAMEFMT setting on the FTP client and the FTP server sides of the session.
  • CD /home/ftp: CD changes the remote directory on your iSeries ftpsrv400 server to the home/ftp directory off the IFS root (/).
  • LCD /home/ftp: LCD changes the local directory on your ftpcln400 AS/400 to the home/ftp directory off the IFS root (/).
  • ASCII: Specifies that this FTP transfer is copying ASCII data between the two systems.
  • PUT index.htm index.htm: Copies the index.htm file on the ftpcln400 server to a file with the same name on the ftpsrv400 server. Because the CD and LCD parameters were changed in the previous statements, you don't have to explicitly state the IFS folder locations in this statement; the FTP session will use the locations from those variables.
  • QUIT: Ends the session and closes the FTP shell.

Using an FTP PUT subcommand isn't the only way to move stream files between boxes, however. While a PUT copies (puts) a file from the FTP client (ftpcln400, in this case) to an FTP server (ftpsrv400), an FTP GET subcommand reverses the direction and retrieves (gets) a file from the server and copies it back to the client.

So to change the example to use a GET subcommand to bring the file back to the client, change the subcommand script to the following:

NAMEFMT 1
CD /home/ftp
LCD /home/ftp
ASCII
GET index.htm  index.htm (REPLACE
QUIT

Note that the REPLACE parameter on the GET subcommand tells OS/400 FTP to replace the index.htm file if it already exists in the target IFS directory.

To modify these transfers to retrieve files from other IFS locations, change the CD and LCD statements to designate the IFS address of directories in different IFS file systems. Here are some examples of how to designate the /home/ftp folder to point to different IFS file systems in CD, LCD, GET, and PUT subcommands.

To designate files in the QDLS file system, which contains document library objects, you could use the following syntax in the subcommands:

CD /QDLS/HOME/FTP
LCD /QDLS/HOME/FTP
GET /QDLS/HOME/FTP/index.htm  
              /QDLS/HOME/FTP/index.htm (REPLACE
PUT /QDLS/HOME/FTP/index.htm  
              /QDLS/HOME/FTP/index.htm 

To copy files from directories in the QOpenSys IFS file system, use the following syntax:

CD /QOpenSys/home/ftp
LCD /QOpenSys/home/ftp
GET /QOpenSys/home/ftp/index.htm  
                  /QOpenSys/home/ftp/index.htm (REPLACE
PUT /QOpenSys/home/ftp/index.htm  
                  /QOpenSys/home/ftp/index.htm 

Be careful when transferring files into and out of QOpenSys, because it's the only IFS file system where directory and file names are case-sensitive. If you don't observe proper case-sensitivity, you could easily produce errors in your FTP transfers or create duplicate files that contain different upper- and lower-case naming patterns (such index.htm and Index.htm).

So there's really no magic in transferring files between IFS locations. All it takes is a basic familiarity with FTP and a little experimentation.


Sponsored By
BYTWARE

It seemed like a normal day at the office.

Little did anyone know that Jennifer in payroll was about to hand out an unexpected pay cut.

With full unrestricted access to the company's accounting and payroll directories, Jennifer's after-lunch system cleaning tossed out not only some old PDFs but this week's payroll files, too.

Don't send your employees into financial shock.

Get Secure.
Get StandGuard.

www.bytware.com


THIS ISSUE
SPONSORED BY:

LANSA
SoftLanding Systems
BCD Int'l
Bytware
Affirmative Computer
Kisco Information Systems


BACK ISSUES

TABLE OF
CONTENTS
StorageTek Recommits to Supporting the iSeries

Palmisano Outlines On Demand for Shareholders, IBM Rolls Out Products

HP Tops Q1 Worldwide Server Shipments, Dell Tops in US

Admin Alert: Copying IFS Files from One iSeries to Another

As I See It: Only Mushers Lead from Behind

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.