SORT
SO
RT [ON] DF_item_1 [(
D
)] [,DF_item_2...] [
F
AST]
orders the selected records using up to 16 items in the selected or related data file(s) as sort items.
arguments notes
ON is used for documentation or ease of understanding.
DF_item_1 is the item used as the primary sort item.
(D) directs INFO to sort the named field in descending order. If (D) is not specified, the field is sorted in ascending order.
,DF_name_2... item or items used as secondary sort items.
FAST If the "FAST" option is specified and the number of record pointers times the width of the key values do not exceed 10,000 bytes the Small File Sort Utility will be executed.
n
The SORT command orders selected records according to the values of up to 16 specified record items. Each item can be sorted in ascending (the default) or descending order. You can sort on any data item from the currently selected and related datafiles.
n
If two or more records have the same value for the specified item(s), INFO leaves those records in their original order.
n
If a sort item is a C-type, the following maximum item widths apply:
Unix 4096
VMS 255
Primos 2196 or 3331 for SORT FAST.
n
If you sort reselected records, that is, if a subset of all of the records in a data file, and then either use the
ASELECT or SELECT commands, INFO puts the reselected records into the positions that the reselected records came from. The positions are noted by the record numbers of the reselected records. The reselected records are replaced inthe file in the order in which you sorted them, not their original order.
INFO Reference Manual Commands 487
SORT example
n
When sorting an ISAM file, it is the INFO bitmap which is sorted, not the actual data.
n
When sorting a data file, INFO creates one or more scratch files. The number of scratch files required depends on the size of the data file and the number of fields you sort. If the SORT command does not finish, you may have to delete these files. See Appendix F INFO
Internal Files.
n
Since a sort is actually carried out in a scratch file and then copied back into the original data file, if your computer system crashes during a sort, the original data file is preserved unchanged and unsorted.
n
Should a system crash cause actual damage to your data file, the DIRECTORY command displays a D in the
EXTERNL column. In that case, you must restore the file before you can access it.
n
The existing file protection status is maintained after
SORT.
ENTER COMMAND >SELECT NAME.LIST
5 RECORD(S) SELECTED
ENTER COMMAND >LIST
$RECNO L.NAME F.NAME
1 ROSEN HESTER
2 DARCY JOAN
3 ASTOR JOHN J.
4 GRAHAM MARTHA
5 PAINTER THEODORE
ENTER COMMAND >SORT ON L.NAME
ENTER COMMAND >LIST
$RECNO L.NAME F.NAME
1 ASTOR JOHN J.
2 DARCY JOAN
3 GRAHAM MARTHA
4 PAINTER THEODORE
5 ROSEN HESTER
488 Commands INFO Reference Manual