Skip to main content  
        iSeries home   |   Easy400     |   CGIDEV2     |   MMAIL  

What about a free ZIP utility on your iSeries?
Save & Zip
by Giovanni B. Perotti (Italy)
If you distribute software for iSeries, you now may stop downloading save files to PC, zipping and uploading them back to the iSeries.

You can have all it done on the iSeries.

Zip and Unzip on your iSeries platform.

This tool features three commands:

  1. ZIPSAVE to save libraries, library objects ot IFS objects and compress the save file into a standard ".zip" file
  2. UNZIPSAVE to decompress (unzip) a ".zipped" save file and optionally to restore objects from that save file
  3. DSPZIPSAVE to display the table of contents of a zipped stream file.
. To compress / decompress save files, commands ZIPSAVE and UNZIPSAVE can use - upon user choice - one of the following tools:
  • Command Jar, available in the IBMi Qshell, whatever release, OR
  • CL commands CPYTOARCF (Copy to Archive File) and CPYFRMARCF (Copy from ArchiveFile), available on IBMi starting with release V7R2.
Command DSPZIPSAVE can just use command Jar, as so far there is no CL command to display the list of contents of a zip stream file.

About iSeries QShell

iSeries QSHELL is a command line interpreter (shell) running on the IBM iSeries computer platform. Qshell is based on POSIX and X/Open standards. IBM created the Qshell interpreter primarily to provide support for the Java Development Kit (JDK) on their iSeries line of computers. The Qshell interpreter can be used interactively or for running shell scripts.
Links: Qshell in the IBM i Knowledge Center (html)
Exploring iSeries QShell (html)
IBM System i - Programming QShell (pdf)

About the "JAR" tool

The "JAR" (Java ARchive) tool - available trough the QShell interpreter - combines multiple files by compressing them into a single jar file.
It is compatible with the jar tool that is supplied by Sun Microsystems, Inc. which was designed mainly to facilitate the packaging of java applets or applications into a single archive.
JAR files are based on the ZIP file format.
Links: ZIP (file format) (html)
jar - The Java Archive tool (html)

Cautions when using the "JAR" tool on iSeries

After reading Thomas Snyder's technical tip Use RPG and QShell for Zipping and Tarring Files, I got the impression that I could use the JAR tool to compress any type of OS/400 file, from an IFS stream file, to a source member.
You can try and believe in success, until you try to decompress (unzip) the compressed files.

The problem here is that the information about the codepage of the compressed files is not retained (the underlying assumption here seems to be that the whole game is for PC objects).
Therefore, when a zipped file is decompressed (inflated), it is given codepage 819 (PC ASCII) whatever its original code page was.
Of course you may then copy the decompressed stream file to another stream file, by specifying the correct target codepage, but that implies that you know what it was.

The next problem is when you want the resulting zip file be processed on a PC. In such a case the zip file (the JAR file) must be codepage 819 (PC ASCII), otherwise the PC unzip utility would not understand it.

In conclusion:

  1. If you want the zipped files be processed by a PC, you must use codepage 819 both for the containing file (the zip or JAR file) and for the contained files (the zipped ones) if they must be accessed by PC users or PC programs.
  2. Zipped files containing binary data (as save files) must be codepage 819 to be understood by a PC, but do not need to be converted to such a codepage. When back to an OS/400 save file, they will be understood again in their original 65535 CCSID.
  3. Text files to be unzipped and read on a PC, must be converted as *text to codepage 819 before they are zipped.
  4. PDF stream files must be converted as *binary to codepage 819 before they are zipped.

What is the ZIPSAVE utility

ZIPSAVE is an iSeries public-source utility available from the Easy400 site.
It was made for distributing save files through the Internet network.
It does take advantage of the iSeries Qshell JAR utility or V7R2 CL commands CPYTOARCF and CPYFRMARCF in order to distribute save files in compressed format.
Zip files generated by this utility can be unzipped on a PC or directly on an iSeries.
The overall contents of a ZIPSAVE generated zip stream file are:
• an optional .txt file containing some installation instructions
• a .savf binary file that can be used to load an iSeries save file.

The ZIPSAVE utility is made of the following commands:

    Allows to run a SAVLIB, a SAVOBJ or a SAV command.
    The QShell JAR tool or CL command CPYTOARCF is used to compress the resulting save file into a user-specified zip file along with a "readme" user-specified text stream file.
     Note- The command takes care of the 819 codepage for both files.
    The QShell JAR tool is used to display the table of contents of the zip file.
    The ZIPSAVE-created zip file can be unzipped on a PC.
    The UNZIPSAVE command uses the Qshell JAR tool or the CL command CPYFRMARCF to performs the unzip on the iSeries.
    Options are available to display the optional "readme" text file and to upload a QGPL save file from the unzipped save stream file.

Command helps provide the detail information needed to properly operate.

See the next pages for details. next page

Installing the ZIPSAVE utility

The download file of this utility contains an installation instructions page. Basically you should
  • Upload to your IBM System i the save file of library ZIPSAVE
  • Restore library ZIPSAVE
  • Start a REXX procedure which creates ZIPSAVE objects from their sources.
To validate the utility, you should try a ZIPSAVE command.
This should not give you troubles.
However, if the QShell command entry shows you some weird messages, you may be missing some PTF(s). I myself had a case with a V7R2 box, see this page.