ILE COBOL Language Reference
This phrase specifies that records are to be processed in ascending or
descending sequence (depending on the phrase specified), based on the
specified sort keys.
- data-name-1
- Specifies a KEY data item on which the sort will be based. Each
such data-name must identify a data item in a record associated with
file-name-1. The following rules apply:
- A specific KEY data item must be physically located in the same position
and have the same data format in each input file. However, it need not
have the same data-name.
- If file-name-1 has more than one record description, then the KEY data
items need be described in only one of the record descriptions.
- If file-name-1 contains variable length records, all of the KEY data-items
must be contained within the first n character positions of the
record, where n equals the maximum record size specified for
file-name-1.
- KEY data items must not contain an OCCURS clause or be subordinate to an
item that contains an OCCURS clause.
- The total length of the KEY data item must not exceed 2 000 bytes.
- KEY data items can be qualified, but they cannot be subscripted or
indexed.
- KEY data items cannot be variably-located.
- Variable length fields can not be used in a SORT key as a variable length
field. Variable length fields are converted into group items by ILE
COBOL. Since variable length fields are converted into group items,
they are compared as alphanumeric data items when used in a SORT key.
SORT lists the KEY data items from left to right in order of decreasing
significance, no matter how they are divided into KEY phrases. The
leftmost data-name is the major key, the next data-name is the next most
significant key, and so forth.
The direction of the sorting operation depends on the specification of the
ASCENDING or DESCENDING keywords as follows:
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.