Comparing UTF-8 data and alphanumeric-group operands
You can compare a UTF-8 literal, a UTF-8 group item, or any elementary data item that
has USAGE UTF-8
with an alphanumeric group or a national group.
About this task
Neither operand is converted. The UTF-8 operand is treated as if it were moved to an alphanumeric group item of the same size in bytes as the UTF-8 operand, and the two groups are compared. An alphanumeric comparison is done regardless of the representation of the subordinate items in the alphanumeric or national group operand.
For example, Group-XN
is an alphanumeric group that consists of two subordinate
items that have USAGE NATIONAL
:
01 Group-XN.
02 TransCode PIC NN Value "AB" Usage National.
02 Quantity PIC 999 Value 123 Usage National.
. . .
If U"AB123" = Group-XN Then Display "EQUAL"
Else Display "NOT EQUAL".
When the IF
statement above is executed, the 5 bytes of the UTF-8 literal
U"AB123"
are compared byte by byte with the content of Group-XN
.
The items compare unequally, and "NOT EQUAL
" is displayed.