A basic sorting operation can arrange, or order, data in an
ascending alphabetical sequence, using a single key data item. The
following example shows the commands you use to direct SORT/XL to
order the last names in the file EMPLOYEE into a standard alphabetical order. Following
the SORT/XL commands, you will see the steps for entering the EDIT/V
subsystem to display the results of the sort process. As mentioned
above, the output file containing the sorted data is named COMPANY.
 |
:SORT HP32214A.01.00 SORT/3000 WED, JUN 3, 1987, 8:20 AM © HEWLETT-PACKARD CO. 1986 >INPUT EMPLOYEE >OUTPUT COMPANY >KEY 1, 11 >END <<The SORT Statistics Appear Here>> :EDITOR HP32201A.07.17 EDIT/3000 WED, JUN 3, 1987, 8:21 AM © HEWLETT-PACKARD CO. 1985 /TEXT COMPANY FILE UNNUMBERED / LIST ALL 1 2 3 4 1234567890123456789012345678901234567890123456789 1 ANDERSON MARY ACCOUNTANT 6345 2 ANDERSON CHARLES SALES REP 3456 3 ANDERSON CHARLES PRESIDENT 0247 4 CARLSON ROBERTA TREASURER 3586 5 FISHER TOM SHIPPING CLERK 7309 6 JOHNSON FRANCES RECEPTIONIST 7943 7 LANGE ROBERT ENGINEER 3235 8 SMITH HOWARD DESIGNER 6794 9 TAYLOR HEATHER SECRETARY 7272 10 ZIMMER ANDREW ENGINEER 5739 /E END OF SUBSYSTEM : |
 |
The SORT/XL program has listed the employee's last names alphabetically.
There are three ANDERSON entries. Notice they are not alphabetized according
to their first names. If there is a tie in a single key sort, as
in this case, he names are listed in the order in which they appeared
in the input file (see where these three names were listed in the
file EMPLOYEE shown earlier in this chapter). Refer to the section
on "Multiple Key Alphabetical Sort" below for information on breaking
ties while running the SORT/XL subsystem.