1039
Text String Processing Instructions Section 3-31
Example In this example, string comparison instructions are used to compare data.
In this example, three text strings are rearranged in alphabetical order. The
original order is as follows:
D100: Milk
D200: Juice
D300: Beer
When rearranged alphabetically, the order is as follows: beer, juice, milk.
>
<>
---
---
---
200.00
0.01
200.02
0.03
200.04
>= <>
D100
D200
D100
D200
D100
D200
D100
D200
D100
D200
D100
D200
D100
D200
D100
D200
D100
D200
0.01
0.03
200.00
200.02
200.04
D100
D101
D102
D100
D101
D200
D201
D200
D201
Address Mnemonic Operand
Text string ABC
Text string ABCText string ABC
Text string ABCD
>$
>$
D100
D200
D200
D300
D100
D200
D200
D300
Milk
Beer
Beer
Milk
Beer
Milk
Alphabetical order
Two text strings beginning with D100 and D200 are compared in
ASCII order from lower to higher. If the text string beginning with
D100 is higher in ASCII order than the one beginning with D200,
then the position of the two text strings will be reversed.
Two text strings beginning with D200 and D300 are compared in
ASCII order from lower to higher. If the text string beginning with
D200 is higher in ASCII order than the one beginning with D300,
then the position of the two text strings will be reversed.
Juice
The juice and beer
text strings are
compared and
their positions are
reversed because
J > B.
Juice
The milk and beer
text strings are
compared and
their positions are
reversed because
M > B.
Juice
The milk and juice
text strings are
compared and their
positions are
reversed because
M > J.
D100: Milk
D200: Juice
D300: Beer
In this way, three text strings can be rearranged in alphabetical order.
Text string