Previous Topic: Field Type N—Fields Exempted From Compression

Next Topic: Field Types S and X—Set of Expected Values


Field Type PD—Packed Decimal Data

Type PD fields contain packed decimal data (USAGE COMPUTATIONAL–3 for COBOL users). The field length must be less than nine bytes. Valid fields must meet the following conditions:

Invalid fields are automatically treated as type UN by CA Compress. Instead of being compressed, a field defined as type PD, which contains invalid data, is enlarged by one bit. No data is lost, and upon expansion, field content is the same as it was before compression. If a field often contains invalid data, type C yields greater compression and lower processing overhead than PD. A message is printed with the statistics produced by the Compression Utility indicating the number of times invalid data was encountered in a PD field during compression.

Packed decimal numbers are converted by CA Compress to binary, bit aligned, variable-length floating point. If the packed decimal numbers are large in magnitude and fill their fields with significant digits (for example, the packed date 76 36 5C in a 3-byte field), then defining the field as type PD yields poor performance in both average time per byte and compression. It is better to specify a type C dedicated to these packed decimal fields. However, if the numbers rarely come close to filling the field with significant digits, type PD yields better performance than other specifications.

Specifically, fields with a value of 0 compress to 6 bits, while fields with a value between -16n-1 and 16n-1 compress to 6+4n bits, regardless of sign or field width.

Consider a file where each record consists of 20, 4-byte packed fields, either written as PDF4, PDF4, ..., 20 times, or abbreviated as a repetition group

20'PDF4'

If the average number of significant digits is 5 or greater, then it is better to define the record as

C1F80

If compression is more important than speed, then specifying

20'C1F3,C2F1'

separately defining the low-order sign bytes gives better results for the same record.