I've been there before on IRIS zlib compression library....
The problem is explained in Compress(), from Class Reference %SYSTEM.Util, Compress() method (emphasis mine):
Returns the compressed form of a given string.
When Type is specified, it is the compress algorithm used to compress the data. Its value can be "zlib", "zstd" or "lz4". If Type is not specified then the "zlib" compression algorithm is used. A compressed string is a compressed data block with a customized wrapper. Use Decompress() to decompress it.
So, after Compress() you need to remove the "customized wrapper":
set compressed=$e(compressed,4,*-5)Unfortunately Decompress() needs the custom wrapper, and I don't know how to make it up, however, as in your sample, I/O can be used, using file in your sample.
Regarding the file I/O, note that form Open command documentation:
"zlib" — Use the zlib compression library. /COMPRESS="zlib" is equivalent to /GZIP=1
So, if you change:
open tmpFile:("WNS":::/COMPRESS="zlib":/GZIP=0):0With:
open tmpFile:("WNS":::/GZIP=0):0It will then work just fine.
I fully agree that it's a pity to have zilib compress/uncompress utility "custimized" with proprietary wrapper that makes it unusable for any "standard use". However in that case you can use I/O, file or other devices. Personally I use XDEV for compress/decompress and leave the silly %SYSTEM.Util.Compress()/Decompress() alone.
- Log in to post comments