SORT
From CometWiki
(New page: SORT Syntax: SORT [ON] field-name[,A|D]][;field-name{,A|D}]... Where: A = ascending order (default) D = descending order Note: A type 2 gateway must be configured if the SORT comm...)
Newer edit →
Revision as of 13:12, 5 June 2009
SORT Syntax: SORT [ON] field-name[,A|D]][;field-name{,A|D}]... Where: A = ascending order (default) D = descending order Note: A type 2 gateway must be configured if the SORT command is used. Refer to the SYSGEN documentation for more information. Placement: Prior to Reporter version 8.00 sorting was only allowed on fields from the primary file. In this case, place the SORT command before the first REPORT command. Beginning with version 8.00 you may sort using fields from any of the files included in the report. If only sorting on primary file fields, continue to use the SORT command before REPORT. If sorting on fields from secondary files, place the SORT command just following the last USING that references a sort field.
Discussion: The SORT command arranges the report data in either numeric or alphabetical order, in either ascending or descending sequence.
If you do not specify a SORT command in your report, the report data is printed in the order in which it is stored in the file. If you do not specify and A or D, for ascending or descending order, respectively, the report sorts in ascending order. Records containing blanks in the sort field(s) print at the beginning of the report.
If multiple sort fields are listed, the records are sorted by the first field, and if duplicate values exist for that field, by the second sort field, etc.
Line continuation
To continue the SORT command to the next line, end the line with a ";" and continue on the next line.
History: As of Release 97.03, the maximum sort length is 252 characters. Example: SORT ON STATE,A;TOTAL.PAST.DUE,D