Previous Topic: Assembler Language

Next Topic: PL/I Optimizing Compiler


COBOL

Normal COBOL CALL statements are used. Parameters are data element names of the areas being passed to the appropriate subroutine. The following considerations must be carefully observed:

SHRINK and EXPAND subroutines

COBOL programs calling the CA Compress subroutines cannot be compiled with the DYNAM option. DYNAM causes unpredictable results for the SHRINK and EXPAND subroutines. Calls to SHRINK or EXPAND pass control to the SHRINK or EXPAND utility, respectively, instead of the SHRINK or EXPAND entry point in the subroutines, resulting in message SHR005I for SHRINK or SHR050I for EXPAND.

This restriction does not apply to the Super Express subroutines, SHRINKZ and EXPANDZ; to the Standard Tables subroutines, SHRINKS and EXPANDS; or to the Hardware Compression subroutines, SHRKHCS and SHRKHCX.

OCCURS DEPENDING ON clause

Because compressed data sets are variable length, to write compressed records of the proper length requires use of the OCCURS DEPENDING ON clause. To avoid data loss and other problems, carefully adhere to the COBOL rules.

Any data beyond the length defined by the OCCURS DEPENDING variable is undefined, so any data placed there by a READ or a call to a CA Compress/2 subroutine may be destroyed. Accordingly, before reading, compressing, or otherwise moving data of an unknown length, always set the variable to its maximum. Afterwards use the data to set it to the correct length before writing.

The variable must be set explicitly by a COBOL statement that names the variable in order for the new value to be recognized by COBOL. In particular, reading a record into an area that contains the variable or changing its value by passing it to a called routine does not cause COBOL to recognize the new value.

Failing to observe these precautions can lead to data loss. For instance, you may successfully compress a record containing more characters than the OCCURS DEPENDING ON variable provides for. COBOL processing then may destroy the extra characters and the damaged record is successfully written. Months later, the record cannot be expanded, and the data is lost.