How to restore *SAVF from within a ZIP in IBM i – “Yep, it really is that groovy!”

IBM i

Nov 02

So, I was trying to help out a buddy in the land of IBM i today. He was trying to install the most recent Beta of Projex4i IBM i Powertools on a clients IBM i Server. The problem he was facing was two fold (a) the connection he was using was very slow so trying to FTP 120+MB onto the machine was taking an age and (b) the FTP setup had blocked access to libraries on the box.

After some serious head scratching, I came up with a way of copying a compressed ZIP upto the IBM i System, and placing this nice small ZIP straight into the IFS. It makes perfect sense to transfer the smallest size possible and then extract (unzip) the file on the IBM i box itself, converting it to a regular *SAVF and then restoring the library. *BOOM*

I gotta write this down before I forget it:

Problem:

We actually have two problems here:

  1. I want to transfer a large library to an IBM i using minimum bandwidth.
  2. I can only use the IFS Windows shares

Solution:

So, lets start out by taking the latest version of IBMi Powertool Library from https://software.projex.com/download

This downloads a ZIP file called PROJEX4I.ZIP which contains a PC version of an IBM i *SAVF – for this example we are assuming its called PROJEX4I.FILE

The ZIP file contains a compressed LIB(PROJEX4I) – thus reducing the 127MB file to a mere 27MB. This screenshot shows these files in a windows folder on our local PC:

We are going to do this:

  1. Copy the ZIP file into an IFS Folder on our IBM i Server
  2. Log into IBM i and (a) use IBM Java to UNZIP it (b) Use IBM FTP to concert the unzipped file into a *SAVF and (c) restore stuff from the save file.
  3. Easy peasy… lemon squeezy

So lets do it…

IBM i Command Line

Log into your IBM i Server and lets create an IFS folder to hold the ZIP file that we are about to send to the IBM i Server:

MD DIR('\projex4i-install') DTAAUT(*RWX) OBJAUT(*ALL)

Now lets flick out into our Windows environment because we want to upload the ZIP file from our PC into the IBM i IFS

From Windows

COPY/PASTE the ZIP to the IFS folder on your IBM i Server from windows.

NOTE: You can also use IBM i Navigator to do this. As long as you end up with the ZIP file living in to the IFS Folder that you just created, its not really important how you do it.

In all the screen shot examples here my IBM i Server name is \\your-ibm-i-server\

IBM i Command Line

Log into your IBM i Server and lets use JAVA to unzip it locally:

cd '\projex4i-install'

Now we are going to use JAVA to *unzip* our distribution file into the same folder:

STRQSH CMD('jar -xf projex4i.zip')

now it an unzipped file and we can use the IBM i TP Server to extract it back into itself and also create a *SAVF along the way.

Check it unzipped OK

WRKLNK OBJ('/projex4i-install/*.*') OBJTYPE(*ALL)
 DETAIL(*EXTENDED) DSPOPT(*ALL)

now we gonna create a SAVE file for it

We are going to put this in a working library called LIB(PROJEXDST)

DLTLIB LIB(PROJEXDST)
/* just in case it exists then delete the old one first */

CRTLIB LIB(PROJEXDST) 
 TYPE(*TEST) 
 TEXT('New installation Library for Projex4i') 
 AUT(*ALL) 

now it’s time for the saucy bit

Lets use FTP to extract from IFS and create a SAVE FILE

ftp IBM-i-Server
enter user/password
namefmt 1
bin 
put /projex4i-install/projex4i.file /qsys.lib/PROJEXDST.lib/projex4i.savf

use QUIT to leave FTP mode

Should be all done – time to restore

Now lets check that the SAVF was created OK

dspsavf projexdst/projex4i

which should look like this:

That’s All Folks!

now go out and restore the lib

RSTLIB SAVLIB(PROJEX4I) 
 DEV(*SAVF) 
 SAVF(PROJEXDST/PROJEX4I) 
 RSTLIB(PROJEX4I)

now you need to just run PROJEX4I/@INSTALL

Follow

About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.