Admin Alert: Moving Libraries Between i5/OS Partitions, Part 2
March 1, 2006 Joe Hertvik
In my last column, I presented the first half of a template for moving libraries between i5/OS partitions, covering how to prepare data for movement and detailed steps for saving a library to a save file. This week, I conclude the plan, showing you how to complete the transfer through FTP, restoring your library to the target system, and checking the results.
To review, my plan for moving libraries between systems contained the following five steps:
This plan will work on all versions of the i5/OS V5 operating system, as well as for earlier versions of the OS/400 V4 operating system. I reviewed the first two steps of the plan in my last column; this week, I will finish the procedure.
Step 3: Transferring the Saved Library to the New Partition or Machine
After you performed the second step, you have created a save file that contains an entire library that will be moved to your target system and restored. The easiest way to transfer the saved library is through FTP. Fortunately, moving save files between different partitions is a relatively routine process that requires you to perform a few simple steps on both the source system, where the library has been saved, and on the target system, where the library will be moved to.
For simplicity’s sake, let’s assume that TCP/IP is up and running on both systems, which is pretty much a given in most shops. Next, you need to make sure that the i5 or iSeries FTP server is running on both systems. To do that, you can issue the following Start TCP/IP Server command (STRTCPSVR) on each partition.
It won’t hurt if the FTP server is already running when you issue this command. Once you are sure that FTP is available, make sure that you have the following pieces of information before you transfer the save file to your target system. You will use all of this information as you perform your FTP transfer.
If the save file that you are transferring to the target partition already exists on that partition, be sure to clear it before you initiate the transfer or the transfer will fail. To clear an existing save file, execute the following Clear Save File command (CLRSAVF).
If the save file does not exist in the target library on the target partition, you do not have to worry about creating it; the FTP transfer script will create the file for you.
When you have your information and you have cleared your target partition save file (if it exists), start an FTP session from your source system. You can do this by running one of the following two FTP commands.
Where nnn.nnn.nnn.nnn is equal to the IP address of the partition you will be transferring the save file to. As you start the FTP session, FTP will ask you to sign on to the target partition you are connecting to with a valid user ID and password for that partition. After you sign on to your FTP session, execute the following FTP sub-commands to transfer the save file.
These are all the FTP sub-commands you will need to easily transfer the save file containing your transferred library from the source system to the target system. Each of these sub-commands performs the following functions.
CD target_save_file_library: This is the Change Working Directory or Library sub-command. Its purpose is to set the working directory on the target FTP server you are communicating with to the name of the library that you want to copy the save file into.
LCD source_save_file_library: This is the Change Working Library or Folder sub-command, which changes the working directory on the partition you are running the FTP session on to the library name that you want to copy the save file from.
BIN: The Binary sub-command tells FTP that this is a binary transfer, which copies the data bit by bit without performing any kind of file conversion on the save file data as it moves the file to the target system.
QUOTE SITE NAMEFMT 1: The Select Naming Format sub-command tells FTP to use the integrated file system format for designating files to be moved through this FTP session. This is critical for insuring that your save file is transferred correctly to the target system.
PUT source_save_file_name.savf: The PUT sub-command tells FTP to send the save file from the working library on the source system to the working library on the target system. The .savf designation attached to the end of the source_save_file_name tells FTP that this is a save file that is being transferred, according to the OS/400 Integrated File System naming format that we specified in the QUOTE SITE NAMEFMT 1 sub-command. If you don’t specify .savf at the end of your file name, FTP will treat this transfer as a regular file transfer and the save file information will be saved as a physical file, not as a save file.
QUIT: Ends the FTP session with the remote system
By running the FTP transfer with these sub-commands, your save file will be transferred cleanly to the target system, and the save file will be created on the target system if it doesn’t already exist there.
Step 4: Restoring the Saved Library to the Target System
At this point, you are 80 percent of the way toward transferring the library and all its data to the target system. Before you restore the library, check to make sure that the existing library doesn’t already exist on your system. If it does, make sure you backup the library before you start so that you can restore missing objects later, if needed.
In the last article, the procedure called for creating and restoring the transferred library exactly as it will exist on the target system, so if the new library already exists on your target system, your best bet for a clean restore is to rename the original library that will be replaced and then restore the new library complete and intact from your save file.
If you want to rename a library to be replaced, run the Rename Object command (RNMOBJ) like this:
RNMOBJ OBJ(Library_name) OBJTYPE(*LIB) NEWOBJ(new_library_name)
And this will rename your existing library to a new name, retaining all the objects and authorities associated with that library.
To restore your library from the save file that you transferred over from your source system, use the Restore Lib command (RSTLIB) like this:
RSTLIB SAVLIB(library_name) DEV(*SAVF) SAVF(target_save_file_library/source_save_file_name)
If you renamed the replaced library or the restored library does not already exist on your system, this command will restore an exact duplicate of your saved library to your target system. If you need to restore your library objects over objects in an existing library, be sure to fill in valid RSTLIB values for the Data base member option (MBROPT) and Allow object differences (ALWOBJ) parameters. These parameters determine how RSTLIB will restore saved objects over any objects that may exist in your target library.
Also note that, because this library was created on a different system, RSTLIB may change some object authorities on the restored libraries and objects to match the user profiles that are available on the new system. This means that you may need to change object owners and user authorities to match the needs of your target partition. This specific task will differ from library restore to library restore, so for general techniques on changing ownership and authorities for a large number of objects in a single library, check out Changing Object Authorities and Owners for an Entire Library and Quicker Ways to Change Library Object Ownership.
Step 5: Checking Your Results
At this point, you have moved a library from one i5/OS partition to another. If you want to make sure that you moved all the objects over, you can run a Display Library command (DSPLIB) like this on both systems:
And check the number of objects listed in each library on each system. If the number of objects in each library is the same, your transfer completed normally. If the numbers are different, you will want to investigate and make some adjustments.
Finally, I recommend that you should also check and print the job log of the job you used for restoring the library, to ensure that no errors occurred in the process. One error that you may want to watch out for is a failure to restore logical files that were built over physical files that resided in a different library on your source partition. When this happens, i5/OS will not be able to restore those files, and you will have to make different arrangements to move those objects. For information on how to print out a job log, see Creating a Bread Crumb Trail for OS/400 Installs.