Admin Alert: Five Minutes to Moving System i Objects Between Partitions
February 27, 2008 Joe Hertvik
Administrators in multiple System i environments are frequently called upon to save and restore files from one i5/OS machine to another. Because you may not always remember the exact steps involved in performing a transfer, this week I’m presenting a five-minute cheat sheet that details every step you need to perform in order to easily save an object and move it to a companion machine via FTP.
The Basic Game Plan
When moving objects between System i partitions, there are five critical steps that you need to follow.
Get your stopwatches ready, because here’s how to do all five steps in five minutes or less.
The File In Question
To illustrate this process, I’ll be transferring the Client Access sample customer file (QCUSTCDT) between a source and a target System i partition. QCUSTCDT is a standard file that IBM has provided with most versions of the i5/OS and the older OS/400 operating systems. It can usually be found in the QIWS library on your system. For this example, I’ll be saving and transferring the file from my source System i partition to a library named HOLD on my target machine.
Step 1: Create or Clear an i5/OS Save File
i5/OS save files are normally used to transfer reasonably sized objects between systems. Save files can be quickly created, and they are used to save any type of system object that could normally be saved to media.
For our example, we’ll use a save file called GARBAGE that resides in the HOLD library on the source system. Before you start the save, you need to ensure that the save file is created on the system and that it is empty. If you don’t currently have a GARBAGE file on your system, you can use the following Create Save File (CRTSAVF) command to create one.
CRTSAVF FILE(HOLD/GARBAGE) TEXT('Save file for transferring data')
This command creates a new empty file for transferring your data. If you already have a GARBAGE save file and you want to clear it before saving the data, use the following Clear Save File (CLRSAVF) command.
Step one is complete. Now you’re ready to save your QCUSTCDT object.
Step 2: Save the Object To the Save File
Saving the object is an extremely simple process. To save our QCUSTCDT object from QIWS into the GARBAGE save file, you can execute the following SAVOBJ command on the source system.
SAVOBJ OBJ(QCUSTCDT) LIB(QIWS) DEV(*SAVF) SAVF(HOLD/GARBAGE)
This SAVOBJ command is the same command that you would use if you were saving QCUSTCDT to media. The only difference is that instead of entering a media drive name into the device (DEVICE) parameter, I entered the ‘*SAVF’ literal, which denotes that this object will be saved to an i5/OS save file. To denote the save file name and library, you enter that location in the save file (SAVF) parameter. Using this command, the file is quickly saved to the HOLD/GARBAGE save file.
Step 3: Prepping the Save File on the Target System
Before you can transfer the save file containing the QCUSTCDT object, you need to ensure that one of the following situations exist on your target partition.
If you’re transferring the GARBAGE save file to the HOLD library on the target partition and that library already has a GARBAGE save file, you can use the same CLRSAVF command that I described in step two to clear the target partition save file.
If the GARBAGE file doesn’t already exist on the target system, don’t worry. The FTP file transfer sub-commands that I’ll explain in step four will automatically create the GARBAGE file on your target partition, if the file isn’t there.
Now you’re ready to transfer.
Step 4: FTP the Save File Between the Source and Target System
After the prep work is complete, you can move the GARBAGE save file containing your data to the target system by using an FTP file transfer. To do that, you must start the FTP server on both systems, if it’s not already started. Run the following Start TCP/IP Server (STRTCPSVR) command on both systems to start your FTP servers.
Once FTP is started, open an FTP session on the source box by running this Start TCP/IP File Transfer (FTP) command.
FTP RMTSYS(Target_system_name or IP_address)
Since you will be transferring the save file from the source partition, that partition is functioning as the FTP client and the target partition is functioning as the FTP server. After the FTP session starts, it will ask you to log on to the FTP server by providing a valid FTP server user ID and password. Once you’re signed on, you can execute the following FTP sub-commands to transfer the GARBAGE save file from your source to your target system.
quote site namefmt 0 cd hold lcd hold bin quote site namefmt 1 put garbage.savf quit
These commands perform the following functions.
After executing these FTP sub-commands, a copy of the GARBAGE save file containing the QCUSTCDT file will now reside in the HOLD library on the target machine.
Step 5: Restoring the Object To the Target System
Once the save file is transferred, it’s relatively easy to restore the file to the HOLD library on the target system. In this case, you would use the following Restore Object (RSTOBJ) command to restore the object from the GARBAGE save file.
RSTOBJ OBJ(QCUSTCDT) SAVLIB(QIWS) DEV(*SAVF) SAVF(HOLD/GARBAGE) MBROPT(*ALL) ALWOBJDIF(*ALL) RSTLIB(HOLD)
If a copy of QCUSTCDT already exists in the library, this particular command will use the Allow Object Differences (ALLOBJDIF) parameter and the Data Base Member Option (MBROPT) parameter to overwrite the existing file.
I’m Afraid Our Time Is Up
And that’s how you can use FTP to easily transfer a file from one i5/OS partition to another partition in five minutes or less. To adapt this template to your situation, you would simply change your SAVOBJ and RSTOBJ commands to specify other objects. If you wanted to transfer different types of objects, such as AS/400 IFS files, DLO files, programs, or source code file, you can continue to use the procedure as listed here. The only difference is that you should execute the proper i5/OS SAVxxx and RSTxxx commands to save and restore the objects from your GARBAGE save file.
About Our Testing Environment
Configurations described in this article were tested on an i5 550 box running i5/OS V5R3. Most of the commands shown here are also available in earlier and later versions of the operating system running on iSeries or AS/400 machines. If a command or function 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.