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...) |
|||
Line 1: | Line 1: | ||
- | SORT | + | |
- | Syntax: | + | == SORT == |
- | Where: | + | |
- | D = descending order | + | Syntax:<br> SORT [ON] field-name[,A|D]][;field-name{,A|D}]... <br> |
- | Note: A type 2 gateway must be configured if the SORT command is used. Refer to the SYSGEN documentation for more information. | + | '''Where:'''<br> A = ascending order (default) <br> |
- | Placement: | + | D = descending order <br> |
- | 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. | + | '''Note:''' A type 2 gateway must be configured if the SORT command is used. Refer to the SYSGEN documentation for more information. <br> |
+ | '''Placement:'''<br> Prior to Reporter version 8.00 sorting was only allowed on fields from the primary file. <br> In this case, place the SORT command before the first REPORT command. <br> | ||
+ | Beginning with version 8.00 you may sort using fields from any of the files included in the report.<br> If only sorting on primary file fields, continue to use the SORT command before REPORT. <br> 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. | + | '''Discussion:''' <br> 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 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.<br> If you do not specify and A or D, for ascending or descending order, respectively, the report sorts in ascending order. <br> 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. | 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 | + | '''Line continuation''' |
To continue the SORT command to the next line, end the line with a ";" and continue on the next line. | 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. | + | '''History:''' <br> As of Release 97.03, the maximum sort length is 252 characters. <br> |
- | Example: SORT ON STATE,A;TOTAL.PAST.DUE,D | + | '''Example:''' <br> SORT ON STATE,A;TOTAL.PAST.DUE,D |
Latest revision as of 11:04, 6 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