fhg
Volume 11, Number 21 -- July 20, 2011

Admin Alert: Porting an Image Catalog Between Power i Boxes using FTP

Published: July 20, 2011

by Joe Hertvik

In a recent article about creating and using image catalogs in lieu of CDs and DVDs for i operating system installations and upgrades, I didn't discuss how to move image catalogs between different i/OS partitions that can be located many miles or time zones apart. To plug that hole, this issue I present two simple programs that enable you to move pre-loaded image catalogs between systems.

Why Move Image Catalogs?

For many organizations, their iSeries, System i, and Power i partitions may reside in different cities, states, or even countries. The production system frequently resides in one location while its matching Capacity BackUp (CBU) system resides in another. And your operations staff that works at the central office may be responsible for upgrading software at all locations.

While it's becoming more common to download CDs and third-party software upgrades directly from a vendor, many vendors still send out upgrades on traditional CDs and DVDs and many administrators prefer it that way. In these cases, physical upgrade media must be loaded on different partitions at different locations before the software can be upgraded. With a shared image catalog that can be transferred between different machines, the staff can load the CD into an image catalog on one machine in the central office and then FTP and restore that image catalog to all machines in its network.

To facilitate that transfer, here's my procedure for transferring image catalogs between different iSeries, Power i, and System i partitions.

A Six-Step System

If you have an image catalog and accompanying entries on a source Power i machine that you want to move to a target machine, you can easily move those objects by executing the following steps on your partitions.

  1. Create a virtual optical device that can be used to read the image files from your image catalog on both the source and the target i OS partitions.
  2. Create an image catalog complete with image file entries for your CD/DVD on the source machine.
  3. Create save files on your source and target system for transferring the source system image catalog and accompanying CD or DVD image files.
  4. On your source system, use the first CL program listed below to save your image catalog and accompanying files for transfer to the target system.
  5. On the target system, use FTP commands or an FTP script to move your image catalog save files from the source to the target system. See this article for a sample FTP script that transfers save files between systems.
  6. On the target system, use the second CL program listed below to restore the saved image catalog and image file entries.

Here's how to perform each step.

Steps 1 and 2: Creating a virtual optical device and image catalog.

You can create a virtual optical device for reading image files through an image catalog by using the following Create Device Desc (Optical) (CRTDEVOPT) command.

CRTDEVOPT DEVD(OPTDEVICE) RSRCNAME(*VRT) TYPE(632B) TEXT('Virtual optical device')

The device type must be 632B (virtual optical device) for this device to process data from an image catalog. When loaded with an image catalog and image file from CD or DVD, this virtual optical device can be used for upgrading software the same as you would any other physical optical device. Create this device on both your source and your target machines.

Once you have your virtual devices created, create an image catalog for the device. The image catalog holds CD and DVD images as image file entries. Create your catalog by using this Create Image Catalog (CRTIMGCLG) command on the source machine.

CRTIMGCLG IMGCLG(IMG_CAT) DIR('/imagedir) TYPE(*OPT) CRTDIR(*YES)

Besides creating the image catalog, CRTIMGCLG also creates the AS/400 Integrated File System (AS/400 IFS) directory that will contain your image files (as specified in /imagedir value for the DIR parameter). For this example, you need only create the image catalog on your source machine. Step five will restore the catalog to your target machine.

Step 3: Create save files to transfer your image catalog and image files.

For the next step, you need to create two save files (SAVF). You'll use one SAVF to save your source system image catalog and the second SAVF is used to save your source system image file entries. You need two SAVFs because we will be using two different commands to save each type of object. Per IBM recommendation, let's name these SAVF files IMGCLGOBJ (for the image catalog) and IMGCLGDIR (for the image file directory).

You can easily create these save files with the following Create Save File (CRTSAVF) commands.

CRTSAVF FILE(QTEMP/IMGCLGOBJ) TEXT('Save file for image catalogs')
CRTSAVF FILE(QTEMP/IMGCLGDIR) TEXT('Save file for image file directory')

Create these files on both the source and the target systems.

Step 4: Load your optical media to the image catalog and save it for transfer

Here's a program I wrote to prepare your image catalog and image files for transfer to the target System. This program loads your CD or DVD to the image catalog and image files and then saves those objects to the save files your created in step three. Compile and run this program on your source system.

0001.00              PGM
0002.00
0003.00              DSPOPT     VOL(*MOUNTED) DEV(OPT01) DATA(*FILATR) +
0004.00                           PATH(/) /* Check to see if there is a CD +
0005.00                           or DVD in the system optical media*/
0006.00              MONMSG     MSGID(OPT1660) EXEC(GOTO CMDLBL(NEXT)) /* +
0007.00                           Skip image file loading if there is no CD +
0008.00                           or DVD in the physical optical media */
0009.00
0010.00              ADDIMGCLGE IMGCLG(IMAGE_CAT) FROMDEV(OPT01) +
0011.00                           TOFILE(IMAGE_FILE) IMGCLGIDX(1) REPLACE(*YES)
0012.00
0013.00  NEXT:       CLRSAVF    FILE(library_name/IMGCLGOBJ)
0014.00
0015.00              CLRSAVF    FILE(library_name/IMGCLGDIR)
0016.00
0017.00              CHGATR     OBJ('/imagedir') ATR(*ALWSAV) +
0018.00                           VALUE(*YES) SUBTREE(*ALL) /* Change the +
0019.00                           image file directory to always save its +
0020.00                           contents. Restore on target system may +
0021.00                           not happen if this isn't set correctly */
0022.00
0023.00              SAVOBJ     OBJ(IMAGE_CAT) LIB(QUSRSYS) DEV(*SAVF) +
0024.00                           OBJTYPE(*IMGCLG) SAVF(Library_name/IMGCLGOBJ) +
0025.00                           /* save the current Image Catalog on the +
0026.00                           system */
0027.00
0028.00              SAV        DEV('/QSYS.LIB/Library_name.LIB/IMGCLGDIR.FILE') +
0029.00                           OBJ(('/imagedir')) /* Save the +
0030.00                           current image catalog file directory */
0031.00
0032.00              ENDPGM

This code performs the following functions:

Lines 3.00 through 12.00 check to see if there is a CD or DVD loaded into the system optical reader. If a CD/DVD is present, it loads that media to the image catalog as an image file in the target directory.

Lines 13.00 through 16.00 clear the save files in anticipation of saving the image catalog and its accompanying image file directory.

Lines 17.00 through 22.00 changes the object attributes on the image file directory and all its objects to allow those objects to be saved (*ALWLSAV). If *ALWSAV isn't set up on these files, you may get an error message when the program saves your image files.

Lines 23.00 through 27.00 use the Save Object command (SAVOBJ) to save your image catalog to the IMGCLGOBJ save file.

Lines 28.00 through 31.00 use the Save command (SAV) to save the AS/400 IFS directory that contains your CD or DVD image files. This directory is saved to the IMGCLGDIR save file.

At this point, you can transfer your image catalog and image files to the target system.

Step 5: Use FTP to move the image catalog and image files to the target system.

Use the FTP techniques outlined in my FTP save file article to move the image catalog and image file save files from the source system to the target system. Once the save files are transferred, they can be used to recreate your image catalog and image files.

Step 6: Restore the saved image catalog and image files to the target system.

You can use the following code to restore the image catalog and its associated image files from your save files to the target system. Compile and run this program on your target system.

0001.00              PGM
0002.00
0003.00              LODIMGCLG  IMGCLG(IMAGE_CAT) OPTION(*UNLOAD) /* Unload +
0004.00                           the existing image catalog on the system*/
0005.00              MONMSG     MSGID(CPF0000)
0006.00              DLTIMGCLG  IMGCLG(IMAGE_CAT) KEEP(*NO) /* Delete the +
0007.00                           existing image catalog and all +
0008.00                           its associated directories */
0009.00              MONMSG     MSGID(CPF0000)
0010.00
0011.00              RSTOBJ     OBJ(IMAGE_CAT) SAVLIB(QUSRSYS) DEV(*SAVF) +
0012.00                           OBJTYPE(*IMGCLG) SAVF(Library_name/IMGCLGOBJ) +
0013.00                           MBROPT(*ALL) ALWOBJDIF(*ALL) /* Restore +
0014.00                           the existing image catalog from the save file*/
0015.00              RST        DEV('/QSYS.LIB/Library_name.LIB/IMGCLGDIR.FILE') +
0016.00                           OBJ(('/imagedir')) ALWOBJDIF(*ALL) /* +
0017.00                           Restore the existing image file directory */
0018.00              LODIMGCLG  IMGCLG(IMAGE_CAT) OPTION(*LOAD) +
0019.00                           DEV(OPTDEVICE) /* Reload the +
0020.00                           image catalog */
0021.00              LODIMGCLGE IMGCLG(IMAGE_CAT) IMGCLGIDX(1) +
0022.00                           OPTION(*LOAD) /* Reload the first +
0023.00                           image file image catalog entry (index+
0024.00                           one) */
0025.00              VFYIMGCLG  IMGCLG(IMAGE_CAT) TYPE(*OTHER) SORT(*YES) +
0026.00                           /* Verify the image catalog for use */
0027.00
0028.00              ENDPGM

This code performs the following functions:

Lines 0003.00 through 0010.00 unload the current image catalog on the target system and then they delete the image catalog and its associated image files.

Lines 0011.00 through 0017.00 restore the save image catalog and its associated image files from the source system.

Lines 0018.00 through 0020.00 reload the newly restored image catalog to the virtual optical device on the target system.

Lines 0021.00 through 0024.00 reload the first image catalog entry (index 1) back to the restored image catalog. Modify this code if you have more than one image file associated with your image catalog.

Lines 0025.00 through 0027.00 verify the image catalog and its associated image files to ensure that they are ready to use.

Using the Restored Image Catalog For Your Upgrades

After completing step 6, you can now use the virtual optical device name to load your software onto your target system. Simply use the name of the virtual optical device created in steps 1 and 2 as your installation device name.

Once you have this basic framework in place, it can be used to easily load and move CD and DVD images between any System i and Power i partitions on your network, providing a way to move installation and upgrade media between machines.


RELATED STORIES

Image Catalogs: Another Timesaving Method for Upgrade or Installs

Five Minutes to Moving System i Objects Between Partitions



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
SYSTEM i DEVELOPER

Join the Gurus at the Summit!

Rise to the i can . . . can you? challenge
at the RPG & DB2 Summit this Oct 17-19 in St. Louis.

Upgrade your skills - and your career - with the latest on SQL, RPG & the Web,
RPG IV, PHP, mobile apps, DB2 for i, SQL tuning, modern tools
and more!

Learn practical, use-it-today tips and techniques from
top experts Susan Gantner, Jon Paris, Paul Tuohy,
Skip Marchesani, Scott Klement, Mike Cain, Kent Milligan

in a highly interactive, fun environment.

Click for sessions.
Register by August 26 for just $1095 - save $300!


Senior Technical Editor: Ted Holt
Technical Editor: Joe Hertvik
Contributing Technical Editors: Edwin Earley, Brian Kelly, Michael Sansoterra
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.

Sponsored Links

Data Storage Corporation:  FREE white paper: 8 reasons to persuade your boss to invest in a DR
New Generation Software:  Leverage POWER7 to do more than run your existing applications
Bytware:  Viruses? You'll Never Know Unless You Scan. FREE Webinar. July 20


 

IT Jungle Store Top Book Picks

BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

The iSeries Express Web Implementer's Guide: List Price, $49.95
The iSeries Pocket Database Guide: List Price, $59
The iSeries Pocket SQL Guide: List Price, $59
The iSeries Pocket WebFacing Primer: List Price, $39
Migrating to WebSphere Express for iSeries: List Price, $49
Getting Started with WebSphere Express for iSeries: List Price, $49
The All-Everything Operating System: List Price, $35
The Best Joomla! Tutorial Ever!: List Price, $19.95


 
The Four Hundred
Still Wanted: A Power-i System of Systems

Post-Recession IT Jobs and Spending Lackluster, Surveys Say

Hosted Services And Great Expectations

Mad Dog 21/21: Smart Fellers

Hands-On, Virtual Training for i Coders and Admins

Four Hundred Stuff
Silvon Re-Emerges with Update to Stratum BI

DR Testing an Integral Part of RES-Q's Services

LaserVault Launches Hybrid Cloud Backup Appliance for IBM i

iWay Detects Business Events in Social Network Feeds

Amazing i Server Survival Story from Australia

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

System i PTF Guide
September 25, 2010: Volume 12, Number 39

September 18, 2010: Volume 12, Number 38

September 11, 2010: Volume 12, Number 37

September 4, 2010: Volume 12, Number 36

August 28, 2010: Volume 12, Number 35

August 21, 2010: Volume 12, Number 34

TPM at The Register
Cisco lays off 6,500 workers, execs

Cisco doubles Catalyst Ethernet ports to 60 watts of juicy juice

Sparc T4 server chip slips into 2012

SeaMicro pushes 'Atom smasher' to 768 cores in 10U box

IBM 'Blue Waters' super node washes ashore in August

Dell's Kace control freak ARMed for SMBs

VMware: We will virtualize entire world in six years

Cisco gooses switching, virtual I/O for blades

VMware taxes your virtual memory

IBM heaves new System z minis at mainframe shops

Monolithic supers nab power efficiency crown

Unix still data center darling, says survey

THIS ISSUE SPONSORED BY:

WorksRight Software
SEQUEL Software
System i Developer


Printer Friendly Version


TABLE OF CONTENTS
INSERT to Overlay Positions in a Character String

Emulate RPG's Pessimistic Locking in SQL

Admin Alert: Porting an Image Catalog Between Power i Boxes using FTP

Four Hundred Guru

BACK ISSUES




 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

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

Privacy Statement