Admin Alert: FTPing Save Files from Windows to i5/OS
July 18, 2007 Joe Hertvik
In administering third-party software on iSeries and System i machines, it’s common to receive program updates as save files delivered to a Windows desktop. Once received, these save files must be uploaded and restored to an i5/OS or OS/400 partition for installation. To make this process easier, this week’s column presents a basic checklist for using FTP to transfer a save file from a Windows PC to an i5/OS partition.
Save files updates usually reach Windows desktops in one of two forms. They are either downloaded as a zip file from a Web site or they can be sent directly to you via email. If you have to manually move a save file from a Windows PC to an i5/OS or OS/400 logical partition, here are nine easy steps to make that transfer as quick and as painless as possible.
1. If delivered in a zip file, extract the file into an empty Windows folder. In many cases, the received save file is delivered in compressed zip file format. So the first step is to use WinZip or another archiving program to extract the delivered files into an empty Windows folder. I specify an empty folder so that you won’t confuse your received files with other files that were saved at another time. If there are any readme or special instruction files extracted from the zip file, be sure to review those files before uploading or applying the changes.
2. Make sure that the save file is named correctly for an upload. Many vendors and Web sites deliver save files that have no file extension assigned to them. When using this checklist, the uploaded file name must end in an extension of .savf or the upload will not work correctly. So if necessary, rename your Windows save file so that it has an extension name of .savf (i.e., if the file is named upload, it must be renamed to upload.savf for this technique to work).
3. Start the FTP server on your i5/OS or OS/400 partition. In this scenario, your Windows box is functioning as an FTP client and your i5/OS partition is serving as the FTP server. For security, FTP servers should not be left on indefinitely and if the server is currently ended, you must restart it to perform this transfer. You can restart the i5/OS FTP server by issuing the following Start TCP/IP Server command (STRTCPSVR).
On an i5/OS box, this command starts multiple FTP jobs in the QSYSWRK subsystem. These jobs will have names like QFTP00207, QTFTP00219, etc. It’s not a problem if you run the STRTCPSVR *FTP command a second time when your FTP server is already running. In that case, i5/OS will simply ignore the duplicated FTP start command.
4. Start an FTP client session on the Windows box where your .savf file is located. You can do this by clicking on the Start button and selecting the Run option off the Windows start menu. Inside the Run input box, type in one of the following two commands.
If you use the first option, DNS_name must equal the DNS name of the i5/OS box you want to start an FTP session with. In the second option, xxx.xxx.xxx.xxx must equal the IP address of the i5/OS box that is running your FTP server. Both options will start an FTP session between your Windows desktop and your i5/OS box.
5. The i5/OS FTP server will prompt you to log on with your user name and password. Enter a user profile name that has proper authority to create and upload a file to your target library.
6. Inside your Windows FTP session, enter the following FTP sub-commands:
QUOTE SITE NAMEFMT 1
Each FTP sub-command performs the following actions.
QUOTE SITE NAMEFMT 1. This command tells the i5/OS FTP server to use the AS/400 Integrated File System (AS/400 IFS) naming format for this file transfer. When transferring to i5/OS libraries, AS/400 IFS formatting uses extensions such as .SAVF to determine what type of objects are being transferred and what format to use for saving a transferred object. We cannot successfully FTP a save file from a Windows PC to i5/OS box without executing this sub-command.
CD QSYS.LIB/System_i_library_name.LIB. Changes the name of the working directory inside your FTP session to the i5/OS library name that you want to transfer the save file into. After running this sub-command, any FTP transfers to or from the i5/OS partition will use this library as its designated transfer location on the System i.
LCD x:folder. Changes the name of the local working directory on your Windows FTP client to the Windows drive and folder name designated in the x:folder literal. All transfers to and from the Windows PC will use the files listed in this folder. If I wanted to use the C:HOLD directory as my Windows local directory, I would type the command like this: LCD C:HOLD.
BIN. BIN designates that the file will be transferred in FTP binary mode, which means that all the information in the file will be transferred bit-by-bit to your target library, exactly as it is stored on the Windows client machine. There will be no ASCII-to-EBCDIC translation for this transfer and the stored file on your i5/OS box will become an exact duplicate of the save file that you transferred from your Windows PC. Virtually all System i vendors that I’ve encountered deliver save files as binary objects.
PUT file_name.savf. A PUT command tells the FTP session to transfer the designated save file from the local working directory on the FTP client (the Windows machine) up to the working directory on the FTP server (the System i, iSeries, or AS/400). The local working directory and working directory locations were defined in the CD and LCD FTP sub-commands listed above. Again, note that the file name being uploaded must end in an extension of .SAVF or the FTP transfer will not work correctly.
QUIT. After the FTP PUT transfer completes successfully, the QUIT statement ends the FTP client session and closes down your Windows FTP session.
7. Once the file is uploaded on your AS/400, run a Restore Library command (RSTLIB) to restore the fixes from the uploaded save file to your system. In most cases, you will be restoring an entire library from the vendor’s machine back to your System i partition. You can perform this restore by running RSTLIB this way:
RSTLIB SAVLIB(SAVED_LIB) DEV(*SAVF)
If you’re not sure what the name of the saved library on your system is, run the following Display Save File command (DSPSAVF) and it will show you the name of the library that was saved, as well as all the objects that were saved inside that library and the command that was used to save the library objects into this save file.
8. End the FTP server with the following END TCP Server command (ENDTCPSVR):
9. Follow your vendor’s instructions for applying the fixes. These instructions can generally be found in a README.TXT file that came with the software. Some vendors will include the README instructions as a member within an enclosed QTXTSRC source file, which can be viewed by using the old Start PDM command (STRPDM) or by using IBM’s WebSphere Development Studio Client for System i product.
And that’s all there is to transferring a save file from a PC to the System i. If you know the ins and outs, it’s a fairly simple operation.
About Our Testing Environment
Configurations described in this article were tested on an i5 550 box running i5/OS V5R3. Many of the commands may also be available in earlier versions of the operating system running on iSeries or AS/400 machines. If a command is present in earlier versions of the i5/OS or OS/400 operating systems, you may notice some variations in the pre-V5R3 copies of these commands. These differences may be due to command improvements that have occurred from release to release.