Sorting is used to retrieve a set of lines. Adelia sort can be used to specify the order in which the lines are returned.
- For Adelia programs, sorting operation can be used with the MANAGE_SFL_SQL, CURSOR and LOAD_SQL_LST instructions.
- For Visual Adelia programs, it can be used with the CURSOR, LOAD_SQL_LST instructions and the *SQL type LOADING instruction.
You must specify, between brackets, the guide words for the columns concerned by the sorting operation, possibly followed by the *ASC parameter (ascending order) or *DESC parameter (descending order). If this parameter is not specified, the sorting operation will be performed in ascending order.
The columns specified must belong to the entities involved in the request.
For example
/* post codes sorted in descending order and names in ascending order
*SORT(CCUST_AREA *DESC, CCUST_NAME)
/* case of a join entity between CUST and INVOICE
/* amounts sorted in descending order, post codes and names in ascending order
*SORT(FINVOICE_AMOUNT _*DESC, CCUST_AREA, CCUST_NAME *ASC).