z/OS CMPSC compression algorithm

The JZOS toolkit provides a wrapper class, com.ibm.jzos.ZCompressor, for the z/OS® CMPSC static dictionary compression algorithm. Static dictionary compression algorithms, such as CMPSC, don't solve the same problems as adaptive compression algorithms. Static compression works well for compressing discrete chunks of data, whereas adaptive compression, as used by the GZIP or ZIP programs for example, speeds up over the life of a stream of data to be compressed.

Any system where chunks of data are discretely processed (for example, Db2® pages, VSAM control intervals, SAM disk blocks) should benefit from a static compression algorithm.

For more information about the compression algorithm and the CMPSC machine instruction, see z/Architecture® Principles of Operation, SA22-7832-13 and Enterprise Systems Architecture/390 Data Compression, SA22-7208.

You can use the SYS1.SAMPLIB(CSRBDICT) SAMPLE REXX program to create a compression and expansion dictionary for a representative sample data set. You can use the following sample JCL code to create these dictionaries then concatenate them into a single data set as required by the ZCompressor class. For more information, see the documentation that is included in the comments of the CSRBDICT program or in the previous references.
//CSRBDICT JOB (),’USER’
//*
//* The following symbol defines the data set containing the
//* text that you will scan. This will also become the
//* prefix for other data sets that are created,
//* and assumes that you have created a ".SPECFILE"
//* data set containing the specs for CSRBDICT.
//* In this example, we have downloaded the public domain text
//* of "Moby Dick" from http://www.gutenberg.org/files/2701/2701.txt
//* and we will generate dictionaries with 4K entries which implies
//* 12 bit symbol sizes, since 4096 = 2**(12+3) / 8.
//*
// SET DSNPREF=MYUSER.MOBYDICK
//*
//TSOTMP EXEC PGM=IKJEFT1A,DYNAMNBR=20
//SYSPROC DD DSN=SYS1.SAMPLIB,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%CSRBDICT 4 1 EB ’MYUSER.MOBYDICK’
//*
//* Concatenate the dictionaries, selecting only
//* the leading (non-blank) 8 bytes from each entry record
//* This assumes that your specfile does NOT have the "asm"
//* option. For this example, the total size in bytes of the
//* output data set will be 64K (4K * 8 * 2).
//*
//CONCAT   EXEC PGM=SORT,COND=(4,LT)
//SORTIN   DD  DSN=&DSNPREF..ACDICT41,DISP=SHR
//         DD  DSN=&DSNPREF..AEDICT41,DISP=SHR
//SORTOUT  DD  DSN=&DSNPREF..CDICTS41,
//             DISP=(NEW,CATLG),SPACE=(CYL,(1)),
//             DCB=(LRECL=8,BLKSIZE=0,RECFM=FB)
//SYSOUT   DD  SYSOUT=*
//SYSIN    DD  *
 OPTION COPY
 INREC FIELDS=(1,8)
//
For this sample JCL code, here are the contents of the &DSNPREF..SPECFILE data set:
** This is the TEXT FILE example from SYS1.SAMPLIB(CSRBDICT):
**    - removed "asm" option - output is 8-byte binary entries
**    - added "opt"
**
**The following is with a 4K-entry dictionary.
**Provides 30.88% compression (output/input) for the source of
**Chapter 5 of the ESA/390 Principles of Operation (30.32% if all output
**bits are concatenated together).
**Optimization (change x under opt to opt) improves compression by 0.7%.
**results maxnodes maxlevels msglevel stepping prperiod dicts 
  r       40000    60        3        f 7 2 7  1000     afd
**colaps opt treedisp treehex treenode dupccs
  aam    opt x        h       n        x
**FLD col type dcenmen              INT  intspec
  FLD 1   sa   dce 4                INT  aeis 1 (40)
                                    INT  a12b3s (40)
  FLD end
**Note: Some text will be compressed better if the INT aeis 1 (40) is
**omitted; i.e., try it with and without the INT aeis 1 (40). Also, if
**the text is ASCII instead of EBCDIC, the 40 should be changed to 20.