BY is a modifier that sorts items in ascending order by comparing the ASCII values of data in the specified attribute. The designated attribute is called a sort-key. Multiple BY clauses can be included in an INFO/ACCESS query to specify primary and secondary sort-keys. The sort-keys are processed from left to right.
Format
BY attribute [BY attribute ...] |
Description
If BY is used with a MultiValued attribute, only the first value is sorted. To sort the individual values in a MultiValued attribute, use the BY-EXP modifier.
Example
This example sorts customers by last name and first name. LAST-NAME is the primary sort-key and FIRST-NAME is the secondary sort-key:
>SORT CUSTOMERS BY LAST-NAME BY FIRST-NAME LAST-NAME FIRST-NAME |
||
|
|
|
PAGE 1 10:58:13 DD MMM YYYY |
||
|
|
|
CUSTOMERS |
Last-Name |
First-Name |
|
|
|
MASH912AE |
ASH |
MARY |
JBOHA126TR |
BOHANNON |
JOHN |
JBUCK26STO |
BUCKLER |
JULIE |
DEDGE338BR |
EDGECOMB |
DAVID |
HJENK1222M |
JENKINS |
HAROLD |
AJOHN760JE |
JOHNSON |
ALICE |
HJOHN455OT |
JOHNSON |
HENRY |
BLEAR34TRE |
LEARY |
BILL |
AORLA55VEN |
ORLANDO |
AMY |
JPEER89RIA |
PEERCE |
JAN |
SPIRS112A |
PIRS |
SANDRA |
|
|
|
11 ITEMS LISTED. |
||
|
|
|
> |
|
|
The JOHNSONs were sorted first by last name, then by first name.
See Also