Comparing national data and alphanumeric-group operands
You can compare
a national literal, a national
group item, or any elementary data item that has USAGE NATIONAL
to
an alphanumeric group.
About this task
Neither operand is converted. The national operand is treated as if it were moved to an alphanumeric group item of the same size in bytes as the national operand, and the two groups are compared. An alphanumeric comparison is done regardless of the representation of the subordinate items in the alphanumeric 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 N"AB123" = Group-XN Then Display "EQUAL"
Else Display "NOT EQUAL".
When the IF
statement
above is executed, the 10 bytes of the national literal N"AB123"
are
compared byte by byte to the content of Group-XN
.
The items compare equally, and "EQUAL
" is displayed.