Format 2 of the SORT statement (table sort) is supported. Most of the details are given in the section The SORT Statement. Additional details are contained in this section.
General Format
Syntax Rules
- For data-name-3, the same rules apply as for data-name-2.
- If the USING phrase is used, data-name-2 and data-name-3 must be described as alphanumeric data items.
General Rules
- Data-name-3, if specified, is the table to be sorted; otherwise, the table specified by data-name-2 is sorted.
- By specifying USING data-name-3, a second table is used for sort processing. In this case, the elements of the table specified
by data-name-3 are transferred to the table specified by data-name-2 and then sorted in the table specified by data-name-2.
The individual table elements are transferred in accordance with the rules for the MOVE statement:
- If the "sending" element is shorter than the "receiving" element, it is padded with blanks;
- if it is longer, it is truncated.
- Transfer of the data-name-3 table elements to the data-name-2 table ends with the last table element of data-name-3 or on
reaching the number of table elements for data-name-2. This means that if the data-name-3 table contains more elements than
the data-name-2 table, the excess elements are not transferred. If it contains fewer elements, the excess elements of the
data-name-2 table are retained unchanged.
- Sort processing does not change the contents of the data-name-3 table.