|
-
Sort records
-
Filter:
-
SORT
-
Syntax:
-
SORT expression
-
Operands:
-
expression :: [COUNT | UNIQUE] [padtype] [sort_sequence] columnrange
padtype :: PAD pad_character | NOPAD (default)
pad_character :: any single character | BLANK (Default) | SPACE | 2 hex digits (ie. 24)
sort_sequence :: A | ASCENDING (Default) | D | DESCENDING
columnrange :: start_column '-' end_column
columnrange :: start_column '.' number_of_columns
start_column :: integer > 0
end_column :: integer > 0
-
Functional Description:
-
Use the SORT stage to arrange records in ascending or descending order. SORT reads
records from its primary input stream and writes the records to its primary output stream,
if it is connected. SORT reads all records from its primary input stream before it
writes any records to its primary output stream.
By default, SORT compares the entire record to determine the order of records in its
output stream. However, you can and should specify one set of key fields to determine the sequence
of records in the output stream. A key field is a specific range of columns within each
record.
COUNT
specifies that each record in the output stream is prefaced with a 10-character field
that represents the number of records with identical key fields. The number is
right-justified with leading ZEROES. Records are considered to be identical if the
specified key fields contain the same data. If a key field is not specified, records are
considered to be identical if they contain exactly the same data.
When COUNT is specified, only the first record is retained; duplicate records are
discarded.
UNIQue
writes all unique records and the first record of each set of duplicate records to the
output stream. Records are considered to be identical if the specified key fields contain
the same data. If a key field is not specified, records are considered to be identical
if they contain the same data.
NOPAD
specifies that shorter key fields are NOT extended with a PAD character before they are
compared with longer key fields in other records.
PAD
specifies that shorter key fields are extended with a PAD character before they are
compared with longer key fields in other records.
ASCENDING
sorts records in ascending order.
DESCENDING
sorts records in descending order.
columnrange
** Currently supports specification of a single group of columns. **
defines a key field to sort on. If you do not specify columnrange, the complete record is
compared. You can specify columnrange as follows:
column
is a single column number.
column1-column2
is a range of columns beginning with column number column1 and ending with column number
column2, inclusive. column2 must be numerically equal to or greater than column1.
column1.n
is a range of n columns beginning with column number column1. You can specify any number
from 1 to 2(12)-1 for n.
-
Secondary Input/Output:
-
none
-
Synonyms:
-
none
-
Usage Notes:
-
The following example will sort the incoming records by the key of column 10 through 16.
| sort 10-16 |
The following example will sort the incoming records in descending order by the
key of column 1 through 40.
| sort D 1.40 |
The following example will sort records in ascending order by the key of column 2 through 18
padding shorter records with character "."
| sort PAD . A 1-18 |
The following example will sort records by the key of column 54-80 with counts.
| sort COUNT 54-80 A |
JAVA Pipelines | Copyright © Cullen Programming 1987, 2012 All Rights Reserved |
|