File Distribution using WINZIP Format on MPE Systems
Heterogeneous Information Systems environments demand sharing files among dissimilar systems for various reasons. For instance, transferring inventory files to a customer, receiving updated inventory data from a vendor, or burning a CD of an entire group of source files prior to beginning a large programming project. Even a method of transferring many files from one system to another during a platform migration.
Sometimes these systems are on the same network and the files can be accessed directly via NFS or Samba. Other times the files must be transported by way of networks or media such as CDs. Files should be compressed prior to transfer to save transfer time, network bandwidth, or disk space. What compression format is compatible with just about any other operating system you will encounter? WINZIP. According to the Info-Zip organization (http://www.info-zip.org/), there are compatible utilities for just about all operating systems.
“Info-ZIP supports hardware from microcomputers all the way up to Cray supercomputers, running on almost all versions of Unix, VMS, OS/2, Windows 9x/NT/etc. (a.k.a. Win32), Windows 3.x, Windows CE, MS-DOS, AmigaDOS, Atari TOS, Acorn RISC OS, BeOS, Mac OS, SMS/QDOS, MVS and OS/390 OE, VM/CMS, FlexOS, Tandem NSK and Human68K (Japanese). There is also some (old) support for LynxOS, TOPS-20, AOS/VS and Novell NLMs. Shared libraries (DLLs) are available for Unix, OS/2, Win32 and Win16, and graphical interfaces are available for Win32, Win16, WinCE and Mac OS. “
While not explicitly mentioned in the list, ZIP and UNZIP command line utilities for MPE are available. They can be freely download from ftp://ftp.nha.co.za. ZIP and UNZIP are stand-alone native mode MPE programs that can be placed anywhere on your system. The group where they are placed must have PH capability. I recommend it be placed somewhere on your HPPATH so that you can reference them as ZIP and UNZIP rather than fully qualifying them.
ZIP
You create a .zip archive of either one or many files using the ZIP program. ZIP has many options which you can see by running the program with no parameters.
:zip
Copyright (C) 1990-1996 Mark Adler, Richard B. Wales, Jean-loup Gailly
Onno van der Linden and Kai Uwe Rommel. Type 'zip -L' for the software License.
Zip 2.1 (April 27th 1996). Usage:
zip [-options] [-b path] [-t mmddyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete files)
-k force MSDOS (8+3) file names -g allow growing existing zipfile
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-b use "path" for temp file -t only do files after "mmddyy"
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zip file prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-y store symbolic links as the link instead of the referenced file
-e encrypt -n don't compress these suffixes
It is best to run ZIP from the Posix shell rather than the MPE prompt. The reason for this is twofold. First, the Posix shell will enable wildcarding of the fileset whereas from the CI prompt you have to individually list each file to be copied into the .zip archive. Second, the shell automatically passes everything after the program name as a single parameter to the program. The CI will pass all of the parameters as an INFO string, thus you have to enclose all of the options within quotes. The following commands are identical in function but as you can see the second one is much easier to type. The more files you want to place in the archive the better off you are running it from the shell.
SOURCE.WERTH:zip "-9 -v archive1.zip TEST TESTPRNT TESTPRT"
adding: TEST (in=5624) (out=1507) (deflated 73%)
adding: TESTPRNT (in=1555) (out=603) (deflated 61%)
adding: TESTPRT (in=512) (out=184) (deflated 64%)
total bytes=7691, compressed=2294 -> 70% savings
SOURCE.WERTH:sh
########################################################################
MPE/iX Shell and Utilities (A.50.02)
COPYRIGHT (c) Hewlett-Packard Company 1992, All Rights Reserved.
>########################################################################
(Shell/iX)/WERTH/PUB>zip -9 -v archive2.zip TEST*
adding: TEST (in=5624) (out=1507) (deflated 73%)
Most utilities derived from Unix share a common syntax. After the program name comes any number of optional arguments separated by spaces, followed by the target of the command, followed by a filename to operate on or a list of files separated by spaces.
>ProgramName [OptionalParameter(s)] target [file [file [file]]]
A very powerful feature in Unix is “shell expansion” which means the shell is responsible for expanding the wildcard into a list of qualifying file names and then passing them to the program. Individual programs do not understand filename wildcards. The MPE Posix shell performs this wildcard expansion.
In the case of ZIP the syntax is:
>zip [OptionalParameter(s)] ZipFileName File(s)ToZip
So when you enter:
>zip archive.zip FILE*
the shell expands FILE* into a list of qualifying file names. It is identical to typing
>zip archive.zip FILE1 FILE2 FILE3
Here are a couple of example ZIP commands. Each will produce a file that can be downloaded to a PC where any or all of the files can be extracted with PKZip or Winzip.
Archive all files in the group PROD.SOURCE. -9 means compress at a higher rate, possibly at the expense of more CPU cycles to produce a smaller zip file.
>zip -r -9 SourceBackup.zip /PROD/SOURCE
Move (archive and delete) files matching V@.EXTRACT.AP into archive named VendorExtract.zip.
>zip -m VendorExtract.zip /AP/EXTRACT/V*
ZIP cannot handle KSAM and NMKSAM files, message files, circular files, and PRIV files. This is not a serious drawback since these file types are not directly portable to other operating systems.
UNZIP
When you are the recipient of .zip files you will invoke the UNZIP program. UNZIP operates similarly to ZIP in syntax.
List the contents of the archive named ZipArchive.zip
>unzip
UnZip 5.31 of 31 May 1997, by Info-ZIP. Maintained by Greg Roelofs. Send
bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.
Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
Default action is to extract files in list, except those in xlist, to exdir;
file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).
-p extract files to pipe, no messages -l list files (short format)
-f freshen existing files, create none -t test compressed archive data
-u update files, create if necessary -z display archive comment
-x exclude files that follow (in xlist) -d extract files into exdir
modifiers: -q quiet mode (-qq => quieter)
-n never overwrite existing files -a auto-convert any text files
-o overwrite files WITHOUT prompting -aa treat ALL files as text
-j junk paths (don't make directories) -v be verbose/print version info
-C match filenames case-insensitively -L make (some) names lowercase
-X restore UID/GID info -V retain VMS version numbers
-M pipe through "more" pager
Examples (see unzip.doc for more info):
unzip data1 -x joe => extract all files except joe from zipfile data1.zip
unzip -p foo | more => send contents of foo.zip via pipe into program more
unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
There are many utilities to accomplish archiving files available including compress/uncompress, lzw, tar, uhaul, mover, store-to-disk, squisher, and others. The WINZIP format is by far most common to the widest variety of operating systems.