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

cobol: Accept arbitrarily-sized PIC X for ANY LENGTH

Cobol parser now accepts any PIC X(n) for ANY LENGTH parameters under MF dialect.

Under the MF dialect, the Cobol compiler now correctly accepts arbitrary-sized PIC X(n) data items when they are used as formal parameters declared with PIC X ANY LENGTH. This change ensures that the compiler properly handles variable-length character data passed between programs.

In Details

In the GCC Cobol front-end, when using the '-dialect mf' option, parameters declared as PIC X ANY LENGTH should accommodate any PIC X(n) passed by the caller. This commit modifies the parser logic (parse.y) to accept and correctly handle such arbitrarily sized PIC X arguments, ensuring type compatibility for dynamic character data.

For Context
PIC X ANY LENGTH
A Cobol data item description that specifies a variable-length alphanumeric string. It can hold character data of any specified length.
PIC X(n)
A Cobol data item description for a fixed-length alphanumeric string, where 'n' specifies the exact number of characters.
MF dialect
A Cobol compiler dialect option in GCC that emulates the Micro Focus COBOL compiler's behavior, often used for compatibility with existing COBOL applications.
Filed Under: cobolcompilerdialect