IBM Support

Compression with ZLIB algorithm - MI Instruction CPRDATA



IBM i 7.5 adds another value to the Algorithm parameter for MI Instruction "Compress Data" (CPRDATA). The new ZLIB algorithm produces a smaller result and improves performance over existing options.


You are in: IBM i Technology Updates > General IBM i Operating System > Compression with ZLIB algorithm - MI Instruction CPRDATA
The ZLIB algorithm provides another option for data compression. Test results show it is often faster than previously available algorithms and generally produces a smaller result, though actual results vary, depending on the compressibility of the data. The new algorithm automatically uses the on-chip Nest Accelerator (NX) GZIP when it runs in Power10 compatibility mode on a Power10 processor and is therefore faster and less CPU-intensive than previously available compression options.
A new value (3) for the Algorithm parameter on the Compress data MI Instruction indicates the ZLIB algorithm is to be used for compression.
Here is a simple coding example:


char *src = <data to be compressed>;

char *tgt = <buffer to hold compressed data>;

_CPRD_Template_T template;

memset(&template, 0, sizeof(_CPRD_Template_T));

template.Source_Length = <size of data to compress>;

template.Result_Length = <length of target buffer>;

template.Algorithm = 3; /* zlib, defaults to automatically use NX accelerator when it runs in Power10 mode on the Power10 processor** */

template.Source = &src;

template.Result = &tgt;


** Note:  The functionality for Power10 mode's use of the NX accelerator supports only Single Level Store source and target addresses, and the source data length must be at least 32KB.  Otherwise, software zlib is used without the boost from the accelerator.
For more information about this topic, see Compress Data (CPRDATA) in IBM Documentation.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000hB4rAAE","label":"API"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.5.0"}]

Document Information

Modified date:
11 May 2022