Save time and aggravation -- automate FTP data transfers

Automate the transfer of libraries from one iSeries to another using batch files and your PC as an immediate host.


Tim Granatir

Sometimes it's the simple things that make the difference.

There are many techniques for transferring data from one machine to another. Some techniques have the advantage of security (tapes, CDs), but they take additional time in delivering the data. When time is critical, FTP offers a fast way to transfer data. Within the process of FTP data transfer, you can use several approaches with various degrees of automation.

The following is an example of automating the transfer of libraries from one iSeries to another by using batch files and your PC as an intermediate host. Generally, a PC is not required to be an intermediary in an FTP transfer between two iSeries, but there are some instances where it is necessary. The most common scenario is when the PC is the only link between two iSeries machines, such as using your local PC to dial in to a PPP line on another iSeries.

In this example, create a directory on the PC called FTPTMP that contains three batch files and also serves as a temporary holding place for a save file. The controlling batch file (GETSEND) calls a batch file (GETFROM) to save and retrieve all of the objects in a transfer library called XFER on the "from" iSeries and puts the save file into your PC directory. The second batch file (SENDTO) sends the save file to the receiving iSeries and restores all of the objects in the save file into a transfer library called XFER on the receiving machine.

The downside to this approach is that USERNAME and PASSWORD need to be replaced with the user name and password of the systems you are connecting. This could be a potential security exposure, which will need to be properly assessed and managed. Once managed, this can be a simple, handy and time-saving technique. In this case, an old-fashioned DOS batch file can still be an effective tool.

GETSEND Source
cd
cd FTPTMP
ftp -i -s:getfrom.bat 10.10.10.1
ftp -i -s:sendto.bat 10.10.10.2 

GETFROM Source
USERNAME
PASSWORD
binary
quote rcmd DLTF FILE(QGPL/FTP)
quote rcmd CRTSAVF FILE(QGPL/FTP)
quote rcmd SAVOBJ OBJ(*ALL) LIB(XFER) DEV(*SAVF) SAVF(QGPL/FTP) PRECHK(*YES)
get qgpl/ftp.savf
quit

SENDTO Source
USERNAME
PASSWORD
binary
quote rcmd CLRLIB LIB(XFER)
quote rcmd CRTSAVF FILE(XFER/FTP)
put ftp.savf XFER/FTP.SAVF
quote rcmd RSTOBJ OBJ(*ALL) SAVLIB(XFER) DEV(*SAVF) SAVF(XFER/FTP)
quit

---------------------------
About the author: Tim is vice president of Technical Services at Interlink Technologies in Maumee, Ohio, where he serves as chief architect for their warehouse management system. He has worked in the banking, insurance, healthcare and distribution industries in various positions, including programmer/analyst, systems analyst and DP manager. Tim has worked on IBM midrange platforms since 1983.

==================================
MORE INFORMATION
==================================

  • Change FTP server to use port other than 21
    Everyone knows that port 21 is the default port for FTP servers. But what if you want to change the port number to make it more difficult for someone to gain unauthorized access to you FTP server? If you've tried to do so and failed, you may think that it's impossible to do. Not true. Search400 expert Tim Granatir knows a way, and he shares it here with you.
  • FTP save files GET as well as they PUT
    FTP isn't quite an exact science, and there's room for different ways for transferring files -- as many readers have pointed out. Writer Joe Hertvik used some of your feedback to his previous tip (Tricks and techniques for FTPing OS/400 save files) to dig even deeper into FTPing save files from one iSeries to another. What he provides here are tips for using the FTP GET sub-command, more information on using the PUT sub-command and details on naming formats when transferring files from the IFS.
  • Implementing FTP and ODBC security on the iSeries 400
    This Search400.com member is looking for suggestions for implementing FTP and ODBC security on the iSeries. According to security expert Carol Woodbury, exit program are essential.
  • FTP secrets revealed
    FTP is one of the top utilities for transferring data to and from the iSeries. Still, users often have problems using it. These resources reveal tips you may not have considered before.


This was first published in August 2002

Dig deeper on FTP

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close