For data file compression the File Handler calls the compression routine that you specify in the DATACOMPRESS Compiler directive.
To call a Micro Focus data compression routine use the syntax:
COBOL:
call "CBLDCnnn" using input-buffer, input-buffer-size, output-buffer, output-buffer-size, compression-type
C:
CBLDCnnn(input_buffer, &input_buffer_size, output_buffer, &output_buffer_size, &compression-type);
where the parameters for routines CBLDC001 and CBLDC003 are:
nnn | A data compression routine in the range 001 to 127. |
input_buffer | A PIC X(size) data item. On entry to the routine it must contain the data to compress or decompress; maximum size is 65535. |
input_buffer_size | A two-byte (int in C, PIC XX COMP-5 in COBOL) data item. On entry it must contain the length of data in the input buffer. |
output_buffer | A PIC X(size) data item. On exit it contains the resulting data. |
output_buffer_size | A two-byte (int in C, PIC XX COMP-5 in COBOL) data item. On entry it must contain the size of the output buffer available; on exit it contains the length of the data in the buffer. |
compression-type | A one-byte (char in C, PIC X COMP-X in COBOL) data item. On entry this must specify if the input data is to be compressed or decompressed:
0 - compress 1 - decompress. |
and for routines CBLDC101 and CBLDC103 are:
nnn | A data compression routine in the range 001 to 127. |
input_buffer | A PIC X(size) data item. On entry to the routine it must contain the data to compress or decompress; maximum size is 256 megabytes. |
input_buffer_size | A four-byte (int in C, PIC XXXX COMP-5 in COBOL) data item. On entry it must contain the length of data in the input buffer. |
output_buffer | A PIC X(size) data item. On exit it contains the resulting data. |
output_buffer_size | A four-byte (int in C, PIC XXXX COMP-5 in COBOL) data item. On entry it must contain the size of the output buffer available; on exit it contains the length of the data in the buffer. |
compression-type | A one-byte (char in C, PIC X COMP-X in COBOL) data item. On entry this must specify if the input data is to be compressed or decompressed:
0 - compress 1 - decompress. |
The RETURN-CODE special register indicates whether the operation succeeded or not. Compression or decompression fails only if the output buffer is too small to accept the results. 0 indicates success and 1 indicates failure.