GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

Cobol SORT statement enhancement for nested tables

Cobol SORT statement now supports sorting within nested tables and qualified names.

The Cobol SORT statement has been enhanced to accept qualified names and nested table names. This change makes the SORT functionality more flexible by allowing operations on more complex data structures. Minor adjustments were made to the lexer’s state machine to accommodate this new parsing capability.

In Details

This commit updates the Cobol front-end to allow the SORT statement to operate on nested tables. Previously, SORT only accepted simple tableish references. The lexer's state machine in scan.l was modified to use more general Procedure Division name recognition rules for SORT, enabling it to parse qualified names and references to elements within nested tables. This aligns with PR cobol/123890.

For Context
SORT statement
A COBOL programming language statement used to sort records in a file or a table based on specified keys.
qualified name
In COBOL, a name that uniquely identifies a data item by specifying its position within a hierarchy of nested tables or records. It uses periods to separate levels, e.g., RECORD-A.TABLE-B(index).FIELD-C.
nested table
A table (an array or similar data structure) defined within another table or record in COBOL. This creates a hierarchical data structure.
lexer
The component of a compiler or interpreter that performs lexical analysis, breaking the input source code into a stream of tokens.
Filed Under: cobollanguageparser