7.117.2 SORT_LIST Examples

Example 1: Sort the entries in a list called #TOTALS by field #COMP into ascending order:

DEF_LIST   NAME(#TOTALS) FIELDS(#COMP #DEPT #DIV #SALES) TYPE(*WORKING) ENTRYS(200)

SORT_LIST  NAMED(#TOTALS) BY_FIELDS(#COMP)

Example 2: Sort the entries in a list called #TOTALS by fields #COMP and #DEPT into ascending order:

DEF_LIST   NAME(#TOTALS) FIELDS(#COMP #DEPT #DIV #SALES) TYPE(*WORKING) ENTRYS(200)

SORT_LIST  NAMED(#TOTALS) BY_FIELDS(#COMP #DEPT)

Example 3: Sort the entries in a list called #TOTALS by field #SALES (descending order), then fields #COMP #DEPT and #DIV in ascending order:

DEF_LIST   NAME(#TOTALS) FIELDS(#COMP #DEPT #DIV #SALES) TYPE(*WORKING) ENTRYS(200)

SORT_LIST  NAMED(#TOTALS) BY_FIELDS((#SALES *DESCEND) #COMP #DEPT #DIV)