COMPARE


ANSI

 

The COMPARE instruction (which may be abbreviated as COMP) compares two numeric fields. The instruction uses the following format:

 

 

[label]

COMPARE

{source1}{sep}{source2}

 

Where:

label

Optional. A Program Execution Label.

source1

Required. A Numeric Variable, numeric Literal, or Expression that serves as the source variable.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

source2

Required. A Numeric Variable, Literal, or Expression to which the {source} variable is compared.

Flags Affected: LESS, OVER, ZERO

Note the following:

  1. The contents of both operands remain unchanged.

  2. The actual contents of the fields are compared. The EQUAL (or ZERO) and LESS Condition Flags are set based on the result of the comparison. The OVER Condition Flag is always cleared.

 

 

See Also: Example Code, Expressions, Mathematical Instructions

 



PL/B Language Reference CHECK11 COS