The
sort function sorts occurrences of records or items based on the value of an item or multiple items. It orders the multiple records or items in the specified group in ascending sequence using the specified data item as the sort key. The sort key item must be contained within the record or item sorted. If a negative sign is included before the item name, the sort will be in descending order. If a
where_condition is included, the function sorts only the occurrences for which the condition is true. When multiple sort keys are provided, the second, third, ... key is only evaluated when the values of the previous keys are identical.
Sort is primarily intended for use in batch applications. It should be used with extreme caution in data entry applications because of possible conflicts between the operator's actions and the program logic.
The function returns a logical value 1 (true) if successful and 0 (false) otherwise.