Data compression enables you to compress the data in a sequential or indexed file. There are two compression mechanisms provided with this COBOL system, run-length encoding (type 1), and extended run-length encoding (type 3).
When a file is defined with run-length encoding, any string of repeating characters is stored as a single character with a repetition count.
You enable data compression using the DATACOMPRESS Compiler directive.
Specifying data compression for a fixed structure sequential file changes it into a variable structure sequential file.
The compression used by a file is determined by the last processed DATACOMPRESS directive when the SELECT statement for the file is processed. Consequently, the compression type can be set for an individual file by using a line of the form:
$SET DATACOMPRESS
immediately before its SELECT statement. You must not forget to turn it off with a $SET NODATACOMPRESS before any other files are processed.
For details on the DATACOMPRESS Compiler directive, see the topic DATACOMPRESS.