You are here: Field Rules Reference > Field Rules Summary > CompBin

CompBin

Use this field level rule to select the largest value of multiple packed decimal fields located on the same record to populate a variable field.

For each given offset in the data section, the source offset is set and the MoveNum rule is called. The highest value is kept in a buffer. After comparing all numbers, the system copies the highest number into the variable field. There are two optional parameters:

Note The system ignores the fields of the entry which usually contain the source offset and the source length. Instead, the system uses the offset and length specified in the data section. The search criteria and the extract field descriptors must be delimited by a single space. No other spaces are allowed.

Example

You could make the following entries in Studio in the Rule section of the field’s Properties window:

In this field...

Enter...

Rule

CompBin

Destination offset

1

Source name

REC-MAXFINE

Source offset

45

File

*

Length

6

Record

*

Required

*

Overflow Multiplier

*

Overflow

*

Mask

11.0,18.0,B

Data

100,XYZ 45,4,67,4

* no entry required for this field in this example

The rule compares the packed decimals on the locations 45-4 bytes and 67-4 bytes in the record identified by a XYZ at location 100 and returns the highest value.