ILE COBOL Language Reference

ASCENDING/DESCENDING KEY Phrase

Data is arranged in ascending or descending order (depending on the keyword specified) according to the values contained in data-name-2. The data-names are listed in their descending order of significance.

ASCENDING/DESCENDING KEY Phrase - Format
 
   .-------------------------------------------------------.
   |                                       .-------------. |
   V             (1)                       V             | |
>>---+-ASCENDING-------+--+-----+--+----+----data-name-2-+-+---><
     |            (1)  |  '-KEY-'  '-IS-'
     '-DESCENDING------'
 
 

Notes:

  1. Cannot be used with boolean data type

The order is determined by the rules for comparison of operands (see Relation Condition). The ASCENDING and DESCENDING KEY data items are used in OCCURS clauses and the SEARCH ALL statement for a binary search of the table element.

data-name-2
Must be the name of the subject entry, or the name of an entry subordinate to the subject entry.

If data-name-2 names the subject entry, that entire entry becomes the ASCENDING/DESCENDING KEY, and is the only key that may be specified for this table element.

If data-name-2 does not name the subject entry, then data-name-2:

Related Information:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]