Previous Topic: Field Type UN — Undefined Fields

Next Topic: Field Types ZL and ZR — Zoned Decimal Data


Field Types V, VP, and VZ — Calculate Variable Symbol Value

Using type V to access the RDW may obtain slightly better compression, because the RDW is excluded from analysis, but the FDT cannot be used for VSAM or other than RECFM=V(B) PS data sets, so considerable inconvenience is likely. Moreover, SUBSYS and the transparency support only V2-4 to access the RDW.

CA Compress RDL provides the capability for defining variable-length fields, and fields which occur a variable number of times, if the length of the variable-length field, or the number of times a variably occurring field is actually present, it is stored within the record or can be calculated from information stored within the record. This capability is implemented using the Variable Symbol, which is coded in RDL specifications as VS.

Field types V, VP and VZ provide the means to calculate and store a value in the VS. VS is then coded in subsequent RDL specifications as a field length, a position reference or a repetition factor. The value stored in the VS during file processing is substituted in the RDL specification in which it appears for each record for which the specification applies. The VS can be referenced multiple times within the definition of the record. The value stored in the VS is changed every time a type V, VP or VZ field is processed.

Field types V, VP and VZ are functionally equivalent. The only difference is the format of the data in the type V, VP or VZ field. Use type V to define fields containing binary integer data, type VP for fields containing packed decimal data, and type VZ for fields containing right-justified zoned decimal data.

RDL specifications for field types V, VP and VZ are coded in one of 3 possible special formats at the user's discretion: tn; tno1i1; tno1i1o2i2 .

Parameter

Description

t

is the field type specification, either V, VP, or VZ.

n

is the length of the V, VP, or VZ field, in bytes.

 

For type V: 1<n<4.

For types VP and VZ: 1<n<8.

o1 and o2

+ = addition

- = subtraction

* = multiplication

/ = division

i1 and i2

are integers between 0 and 32767.

Any remainder resulting from a division operation is dropped.

Arithmetic operations are evaluated left to right. The following are examples of the special formats:

Format

Description

V4

The 4-byte field currently defined contains a binary integer whose value is to be stored in the VS. Using the VS in a subsequent RDL specification refers to the value of the binary integer.

V4+500

500 is added to the binary integer, as described in the previous example, and the result is stored in the VS.

VP3-3/20

The 3-byte field currently defined contains a packed decimal number. Three is subtracted from the number, the result is divided by 20, and the end result is stored in the VS.

The type V specification is often used in CA Compress/2 calls to process variable-length records using the RDW. For example, for a variable-length record that is treated as a single type C1 field, the record definition is written as

V2-4,GAF2,C1FVS.

The record length is picked up from the first 2 bytes of the RDW, from which the RDW length, 4, is subtracted. The next 2 unused bytes of the RDW are treated as a garbage field, while the remainder of the record is character data.

Consider a variable-length record made up of the 4-byte RDW, followed by a fixed 80-byte field that is followed by a variable number of 40-byte appendages. The fixed portion is treated as type C1, while each appendage contains 10, 4-byte packed decimal numbers. The record is defined as

V2-84/40,GAF2,C1F80,VS'10'PDF4''.

One restriction applies to type VP and VZ fields. If invalid packed decimal data is encountered in a field defined using VP, or invalid right-justified zoned decimal data is encountered in a field defined using VZ, CA Compress abends with a user code of 20, and the following message is written to the system output writer:

VP
INVALID TYPE VZ FIELD

Coding the RC parameter when calling the SHRINK or EXPAND subroutine suppresses the abend, as shown with the messages:

REC DEFS IMPLY WRONG LENGTH

and

CHECK BYTE MISMATCH

See the chapter CA Compress/2 and the CA Compress Data Compression Messages Guide for more information.