Compressed records are variable-length records. This fact requires special attention in COBOL application programs, because COBOL does not support variable length data conveniently. For this reason, it is especially advisable with COBOL to use the CA Compress Transparency or SUBSYS and not CA Compress/2.
Variable-length records are defined by the OCCURS DEPENDING ON data-name clause, where the element defined by data-name contains a value which indicates the actual number of characters in the variable- length record. The SHRINK subroutine (but not SHRINKZ or SHRINKS, which do not use RDL) generates this value and places it in the compressed record in response to a field type L record definition, but COBOL does not recognize this value until it is explicitly placed in data-name by a COBOL statement. Field type L does not support records larger than 32K.
The following procedure is recommended for altering a COBOL application program to process a compressed file.
01 SHRUNK-RECORD. 03 LENGTH PICTURE 9(4) USAGE COMPUTATIONAL. 03 SHRUNK-DATA PICTURE X OCCURS n TIMES DEPENDING ON LENGTH.
Substitute the maximum record length for the value n.
01 COMPRESS-AREA. 03 RDW PICTURE 9(5) USAGE COMPUTATIONAL. 03 SHRUNK-RECORD-OUT. 05 LENGTH-OUT PICTURE 9(4) USAGE COMPUTATIONAL. 05 SHRUNK-DATA-OUT PICTURE X OCCURS n TIMES DEPENDING ON LENGTH-OUT.
The user must substitute the value of the OUTFILE LRECL increased by 290 for the value n, and must explicitly move this value to LENGTH-OUT before the SHRINK call to ensure that COMPRESS-AREA is long enough. Code COMPRESS-AREA as the second (CRA) parameter of the SHRINK subroutine call. If the output record definition in the FILE SECTION is coded:
01 UPDATED-SHRUNK-RECORD. 03 UPDATED-LENGTH PICTURE 9(4) USAGE COMPUTATIONAL. 03 UPDATED-SHRUNK-DATA PICTURE X OCCURS n TIMES DEPENDI NG ON UPDATED-LENGTH.
The updated compressed record is written as follows:
MOVE LENGTH-OUT TO UPDATED-LENGTH.
WRITE UPDATED-SHRUNK-RECORD FROM SHRUNK-RECORD-OUT.
| Copyright © 2012 CA. All rights reserved. |
|