SORT-BY section
The SORT-BY section is an optional section that is used to specify the sort order of the extraction results of each SELECT section condition (the results of RUNMODE(EXTRACT)).
SORT-BY:
field1[(A|D)] field2[(A|D)] ... fieldN[(A|D)]
where the field names are a set of fields defined for the target object-type, and the value specified in the brackets specifies the SORT direction. Valid sort direction values include A (ascending) or D (descending). If no sort direction is specified after the field, then A (ascending) is used by default.
SORT-BY:
NAME(A) DEPARTMENT USERID(D)
In this example, the result of each WHERE clause from the SELECT section will be sorted by NAME in ascending order, then DEPARTMENT in ascending order, and then USERID in descending order. This is the equivalent of ORDER BY NAME ASC, DEPARTMENT ASC, USERID DESC in SQL.