Newsletters   Subscriptions  Forums  Store  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 4, Number 6 -- February 25, 2004

Get Rid of the SNADS Headache with Auto-FTP


by Wendy White

[The code for this article is available for download.]

Do you need a fast, reliable way to send code between iSeries boxes? With my Auto-FTP command, you can easily send code from PDM by setting up a user-defined option to do the work for you. It takes advantage of the iSeries' powerful batch processing, as well as the ease of OS/400's FTP utility.

Auto-FTP will automatically save the selected objects, transfer them to a remote system, and automatically restore them for you. If you haven't used FTP before, you'll quickly find it is one of the easiest ways to distribute objects to remote locations. Once you start using this method, you'll wonder how you ever survived without it.

The command consists of two text files, two CL programs, and one RPGLE program. The two text files are used as input/output tables to store commands and messages related to the file transfer. One CL program gathers information about the object you are transferring, while the other starts the FTP session needed for the transfer. The RPGLE program dynamically builds the script from the command parameters.

CREATING THE AUTO-FTP COMMAND

Before you begin copying the code, you should create a source file with a record length of at least 240. You will need that length because the two text members that we are going to create need to be long enough to store the script and messages that we will be storing during our transfer. Here is the command used to create the source physical file:

CRTSRCPF FILE(YOURLIB/FTPSRC) RCDLEN(240) TEXT('FTPPARM Source File')

After you have created your source physical file, create two empty text members. Create one called FTPMSD and the other FTPMSM. FTPMSD will hold your script commands while the session is executing, and FTPMSM will hold all of the FTP messages.

Next, create a SAVF called FTPSAVE on the iSeries you are transferring from and the iSeries you are transferring to, using the following command on each box:

CRTSAVF FILE(YOURLIB/FTPSAVE) TEXT('FTP Save File -- AUTO-FTP')  

Let's take a look at the command FTPPARM. The command prompts for some standard FTP parameters such as system name or IP address, user ID, password, object name, target release level, and object library. Note that the password parameter has the DSPINPUT parameter set to *NO. This prevents your password from being stored in the script or the message log for other users to see. This command supports only the basic FTP options needed to send objects to the remote iSeries. With a little tweaking, it could easily accommodate all of the FTP parameters.

FTPPARMCL is the program that processes the FTPPARM command. This CL program captures the input parameters and essentially submits the rest of the job stream to batch. For more information on commands, check out Kevin Vandever's article "Back to Basics: Home Grown Commands." If you're already secure in your knowledge of commands, you can get right to compiling your command, using FTPPARMCL as the command processing program.

The next step in the job stream is CL program FTPPGM. FTPPGM clears the save file used for the transfer and saves the object or objects specified in the input parameters. The text files that store the script and messages for the transfer are then cleared. Then RPGLE program FTPPARMRG is called. This program dynamically builds the script from the input parameters.

Once the script has been built, FTPPARMRG ends and FTPPGM resumes control. It starts the FTP session and begins executing the script from FTPMSD text member while logging each step to FTPMSM text member. Once your transfer is complete, you can view the logged messages to ensure that your transfer completed successfully.

CREATING THE USER-DEFINED OPTION

After you have created the text members and programs, you can create a user-defined option in PDM. First, Press F16 from PDM to get to the "Work with User-Defined Options" screen. From there, you can create a new option by pressing F6. I called my option FT. You can call yours what you'd like. Here is how it should look:

                                                                                
   Option  . . . . . . . . :   FT                                               
                                                                                
   Command . . . . . . . . :   YOURLIB/FTPPARM ??SYSNAME(*N) ??USER(*N) ??PASSW
ORD(*N) OBJECT(&N) LIB(&L) ??RLIB(&l) ??TGTRLS(*prv) ??MBRO(*N) ??ALWO(*N) 

YOURLIB should be the library that your command resides in, and should also be replaced in all the source code with the library where your objects will exist.

This new user-defined option will work from object PDM and source PDM, whichever you prefer.

If you are using ACMS Change Management and want to use this option, the object you are working with must be in development or integration. In other words, you cannot use this option from the "Work with Objects by Release" screen; it can only be used from the "Work with Objects by Developer" screen. A Change Management tool is a nice utility to build on and use to automate your distributions.

USING THE FTPPARM COMMAND

Since I have created this command on our iSeries, I have lost count of how many times I have used it. It has saved me a tremendous amount of time. If your development environment has multiple iSeries, you will quickly see its benefits, too.


Wendy White is a senior software developer for a software firm in Springfield, Illinois. Email: r.kinison@insightbb.com

Sponsored By
CLIENT SERVER DEVELOPMENT

Never Worry About Time Again

The Atomic Time Manager 400 is an easy-to-use utility developed by Client Server Development. It resides on your iSeries and automatically adjusts your hardware and software clocks to:
· Regulate daylight savings time
· Synchronize with a network time device or other servers
· Participate in HIPAA or EDI transactions

Click here to learn more about the Atomic Time Manager 400 and order yours for just $499 through Guild Companies now!


Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Editors: Raymond Everhart, G. Wayne Hawks,
Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

THIS ISSUE
SPONSORED BY:

Guild Companies
Client Server Development
WorksRight Sofware
COMMON
Profound Logic Software


BACK ISSUES

TABLE OF
CONTENTS
iSeries Navigator: Application Administration

Get Rid of the SNADS Headache with Auto-FTP

Is Your File Transfer Still Active?

A Chicken-and-Egg Trigger Problem

OS/400 Alert: Security Starts At Home



Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement