Skip to content

COBOL: a full-width space (U+3000) separator hides data entries and pictures (opensourcecobol4j dialect) #3956

Closed

Description

@squid-protocol

Found while preparing the opensourcecobol4j fresh estate (#3806, epic #3803). This was a pre-trial scan with no porting.

Defect

Some Japanese COBOL compilers accept the full-width (ideographic) space U+3000 as a separator, the same as a space. opensourcecobol4j / opensource COBOL do so: mb-space.at tests "Zenkaku SPC delims in headings / record def / COPY stmt" and expects them to compile and run. Other Japanese compilers were not checked. The engine's COBOL separators are [ \t] only, so:

  • 01<U+3000>F02 PIC X.: the entry is missing from record_data;
  • 01 F04 PIC<U+3000>X.: the entry is kept but its picture is lost (empty pic);
  • 01 名前<U+3000>PIC X(40), DATA<U+3000>DIVISION, COPY<U+3000>inc. fail the same way (division headers, COPY members).

On the estate, all 7 mb-space programs of cobol_utf8 / i18n_sjis (9 in i18n_utf8) lose entries. That includes ASCII-named items (F00-F04) that sit behind a U+3000.

Minimal reproduction (origin/main 3f8bdb6)

mkdir -p estate
printf '       IDENTIFICATION DIVISION.\n       PROGRAM-ID. MBSPACE.\n       DATA DIVISION.\n       WORKING-STORAGE SECTION.\n       01 F01 PIC X.\n       01\xe3\x80\x80F02 PIC X.\n       01 F03\xe3\x80\x80PIC X.\n       01 F04 PIC\xe3\x80\x80X.\n       PROCEDURE DIVISION.\n       MAIN-PARA SECTION.\n           DISPLAY F02.\n           STOP RUN.\n' > estate/MBSPACE.cbl
GITGALAXY_DISABLE_GIT_HISTORY=1 python -m gitgalaxy.galaxyscope estate --db-only --output out
sqlite3 out/estate_galaxy_master.db "select level_number, item_name, pic from record_data"

Actual:

1|F01|X
1|F03|X
1|F04|

Expected: F01 X, F02 X, F03 X, F04 X.

Notes

  • This is a dialect feature: it is not verified that IBM Enterprise COBOL treats U+3000 as a separator. It might be gated on the estate's dialect / encoding rather than accepted everywhere. At minimum, the scan should report the entry it could not read instead of dropping it silently.
  • U+3000 inside a literal ('日本/中国 文字0') is data and must stay as it is.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TmgE1CwLgaqxqKEgQn5Dw5

Activity

  1. added
    bug
    legacy-modernization
    on Sep 28, 2026
  2. changed the title [-]COBOL: a full-width space (U+3000) separator hides data entries and pictures (Japanese dialects: opensourcecobol4j, NetCOBOL)[/-] [+]COBOL: a full-width space (U+3000) separator hides data entries and pictures (opensourcecobol4j dialect)[/+] on Sep 28, 2026
  3. added a commit that references this issue on Sep 28, 2026
    d6ba635
  4. added 3 commits that reference this issue on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglegacy-modernizationpriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions