RPG/400 Help
The compare operations are:
In the ANDxx, CABxx, CASxx, DOUxx, DOWxx, IFxx, ORxx, and WHxx operations,
xx can be:
- xx
- Meaning
- GT
- Factor 1 is greater than factor 2.
- LT
- Factor 1 is less than factor 2.
- EQ
- Factor 1 is equal to factor 2.
- NE
- Factor 1 is not equal to factor 2.
- GE
- Factor 1 is greater than or equal to factor 2.
- LE
- Factor 1 is less than or equal to factor 2.
- Blanks
- Unconditional processing (CASxx or CABxx).
The compare operations test fields for certain conditions. Resulting
indicators assigned in positions 54 through 59 are set
according to the results of the operation, or a branch occurs based on the
results of the operation. No fields are changed by these
operations.
Remember the following when using the compare operations:
- If numeric fields are compared, fields of unequal length are aligned at
the implied decimal point. The fields are filled with zeros to the left
and/or right of the decimal point making the field lengths and number of
decimal positions equal for comparison.
- If character fields are compared, fields of unequal length are aligned to
their leftmost character. The shorter field is filled with blanks to
equal the length of the longer field so that the field lengths are equal for
comparison.
- All numeric comparisons are algebraic. A plus (+) value is
always greater than a minus (-) value.
- Blanks within numeric fields are assumed to be zeros.
- Numeric fields are converted to packed decimal format, if necessary,
before they are compared.
- If an alternate collating sequence (position 26 of the
control specification) has been specified for the comparison of character
fields, the fields are converted to the alternate sequence and then
compared. If *HIVAL and *LOVAL are used to set up the comparison, the
alternate collating sequence may alter the value before the compare
operation. However, the actual field value will not change.
- A character field cannot be compared with a numeric field.
- An array name cannot be specified in a compare operation, but an array
element may be specified.
- The ANDxx and ORxx operations can be used with DOUxx, DOWxx, IFxx, and
WHxx.
[ Top of Page | Previous Page | Next Page | Table of Contents ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.