GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cobol

Update COBOL tests for IBM COMP- formatting differences.

COBOL test suite updated to reflect correct IBM `COMP-1` and `COMP-2` formatting for numeric `DISPLAY` operations.

This commit updates the COBOL test suite to correctly reflect the IBM-formatted COMP-1 and COMP-2 types when using the DISPLAY verb. Specifically, tests for displaying 1.23 now expect the output to be .123 01, aligning with the expected behavior of IBM COBOL for these numeric representations. This ensures the GCC COBOL frontend accurately emulates platform-specific formatting for these data types.

In Details

The cobol frontend for GCC aims to support various COBOL dialects, including IBM's. This update specifically targets the DISPLAY verb's behavior with COMP-1 (single-precision floating-point) and COMP-2 (double-precision floating-point) data types under the IBM dialect. The generated .out files in the cobol.dg/group2 test directory are modified to reflect the canonical IBM formatting for floating-point numbers when explicitly using DISPLAY. The test ensures that a value like 1.23 is rendered as .123 01, which is the expected representation for these packed decimal-like floati…

For Context

COBOL is a programming language primarily used for business applications. When COBOL programs display numbers, especially those stored in specific internal formats like COMP-1 or COMP-2 (which represent single- and double-precision floating-point numbers, respectively), the exact way they are presented can vary between different COBOL compilers or platforms, such as IBM mainframes. This change updates the tests for the GCC COBOL compiler to make sure it produces the exact same output format as IBM COBOL when dealing with these COMP-1 and COMP-2 numbers using the DISPLAY command. For example, if you ask to DISPLAY the number 1.23, the IBM COBOL dialect has a specific way of formatting it, in this case expecting .123 01. By updating the tests, the developers ensure that GCC's COBOL compiler faithfully reproduces this expected behavior, which is important for compatibility with existing COBOL systems.

Filed Under: coboltestingibm-dialectdata-formatting