Previous Topic: RDL Condition Groups

Next Topic: General Restrictions on RDL Use


RDL Position Function

As fields are processed, CA Compress automatically adjusts an internal field pointer (IFP) to the current displacement within the record. In a few special cases, you can alter this IFP with the Position Function.

For example, fields exempted from compression (that is, fields defined with the field type-N RDL specification) must be defined before any variable or condition group RDL specifications. If a field exempted from compression is located at a higher displacement from the record origin than variable-length fields or conditionally present fields, the Position Function must be used to set the IFP at the field exempted from compression, so it can be defined first. Then the Position Function must be used again to reset the IFP to the lower displacement so the variable-length and/or conditionally present fields can be defined.

The Position Function has 4 possible forms, chosen at the user's discretion:

Form

Description

Pn

Set IFP to n.

P+n

Add n to the IFP.

P-n

Subtract n from the IFP.

P

Reset IFP to prior value.

P is coded as shown; n is either a 1- to 5-digit integer or the Variable Symbol, VS.

Displacements are computed relative to 0, which indicates the start (origin) of the record. The 4 Position Function forms perform the following functions:

Form

Description

Pn

repositions to the n+1th byte in the record.

P+n

repositions forward n bytes.

P-n

repositions backwards n bytes.

P resets the IFP to its value immediately preceding the last Pn, P+n or P-n. If there were no previous Position Functions executed, the P is ignored. P cannot be specified as the initial Position Function. You must adhere to the following rules:

For example, a hypothetical name and address file contains 3 types of 80-byte records as shown below.

The following RDL specifications define this file:

 P79,(01A,P,C1F79)b(01B,P,C2F79)b(01C,P,C3F74,ZRF5),P+1

RDL Specification

Description

P79,

sets the IFP at the RECORD TYPE field. (Note that the IFP is relative to zero, thus IFP of zero is the first record position, and IFP of 79 is the 80th byte of the record.)

(01A,P,C1F79)b

If the RECORD TYPE field contains A, resets the IFP to the beginning of the record, and defines the NAME field.

(01B,P,C2F79)b

If the RECORD TYPE field contains B, resets the IFP to the beginning and defines the STREET ADDRESS field.

(01C,P,C3F74,ZRF5),

If the RECORD TYPE field contains C, resets the IFP to the beginning and defines the CITY, STATE and ZIP CODE fields.

P+1

At this point, one of the condition groups has been applied to the record (provided that all records in the file contain either A, B or C in the RECORD TYPE field), and thus the IFP is again pointing at the RECORD TYPE field. It is necessary to code P+1 to position the IFP at the byte location following the last byte of the record. Failure to do so results in an abend with a user code of 4 and the message, REC DEFS IMPLY WRONG LENGTH.