SORT
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
SORT (<File id>, <File layout>, <Field list>)
Description
The command ‘sort’ is used to sort the order of records in a file.
Diagram
Returned value type
None
Parameters
Parameter | Description |
<File id> | Identifier by which the file is referenced. |
<File layout> | The name of the layout to be used for organizing the file that is linked to the <File id>. |
<Field list> | List of fields that can be found in the file separated by a comma. Each field may be preceded by ASCENDING (ASC) or DESCENDING (DESC, or DSC) denoting the sort order. The default sort order is ascending. |
Remarks
For files that contain CR/LF in the middle of the data combined with CR/LF as line endings, the ContainsComp function should be enabled. |
The ‘sort’ command must be specified with the ‘file id’, and the ‘file layout’ name. The field list to sort on must then be specified. One or more fields can be specified, each separated with a comma.
By default the fields are sorted ascending. If a field needs to be sorted descending then it must be prefixed with 'desc' or ‘dsc’.
Examples
sort (file_a, fbuf_90, dsc intern, disctrict, invoiceno, invoicepart)
sort (tracking, rec_tracking, track_date, dsc track_time)
sort (tracking, rec_tracking, track_date, dsc track_time)