Sorting a List

The SORT subcommand lets you change the order that data is displayed in.

The syntax of the SORT subcommand is as follows:

Read syntax diagramSkip visual syntax diagramSORTsort_ordercoln
sort_order
Read syntax diagramSkip visual syntax diagramAD
You can specify the following:
sort_order
The sort order. It can be:
A
The list is displayed in ascending order. This is the default.
D
The list is displayed in descending order.
coln
The column to be sorted on. You can specify more than one column, separated by a comma or a blank.
For example, specifying SORT D,3 1 4 sorts the display in descending sequence and in the order column 3, 1, and 4.

For commands that support horizontal scrolling (for example, DISPSTAT or INGLIST), the column title (header) can be used instead of column number. The title can be abbreviated. First match is taken. For those commands you can also enter SORT without parameters which leads you to the column tailoring panel. There you can assign sort orders and sort keys to the columns. You can also hide columns or change the column sequence and whether a column is to be prefixed (show on every panel) or not. Refer to the online help on the column tailoring panel for further capabilities of SORT.