VMS Help  —  COBOL  PROCEDURE_DIVISION, SORT  2format_table
  The SORT statement orders a table.  It sorts the table elements
  based on the keys as specified in the OCCURS for the table.  The
  table keys as specified in the OCCURS can be overridden with keys
  as specified in the SORT statement.  If no key is specified, the
  table elements are the SORT keys.

  Format -

   SORT table-name [ ON { ASCENDING  } KEY { sortkey } ... ] ...
                   [    { DESCENDING }                     ]

      [ WITH DUPLICATES IN ORDER ]

      [ COLLATING SEQUENCE IS alpha ].

1  –  table-name

  is a table described with OCCURS in the Data Division.

2  –  sortkey

  is the data-name of a data item in the table-name table.

3  –  alpha

  is an alphabet-name defined in the SPECIAL-NAMES paragraph of the
  Environment Division.
Close Help