Repository navigation
Description
Found while preparing the opensourcecobol4j fresh estate (#3806, epic #3803): no porting was run. This was a pre-trial scan and generation.
Defect
The COBOL readers' name classes are [A-Z + NATIONAL + 0-9-]. NATIONAL covers only the European mainframe national characters (#3810 / #3814). Japanese user-defined words are legal in IBM Enterprise COBOL (DBCS names), Fujitsu NetCOBOL, opensourcecobol4j and GnuCOBOL. The scan does not see them, and nothing warns about it:
| channel | what happens |
|---|---|
| PROGRAM-ID (class_data) | PROGRAM-ID. 日本語のプログラム名. gives no class. GalaxyIR.is_program is False, so the program is dropped from refraction: no IR dump, no port ticket, no Java. |
| record_data | A name that STARTS with a Japanese character is missing (01 顧客レコード, 05 顧客番号). A name with a Japanese tail is truncated at the first non-ASCII character (X項目 becomes X), so two different items can collide. |
| function_data | Sections and paragraphs with Japanese names (主処理 SECTION.) are missing. |
| same class, ASCII | FIXED_FLD becomes FIXED: _LEVEL_START in gitgalaxy/core/mainframe_boundary.py also lacks _, which GnuCOBOL / opensourcecobol4j / Micro Focus accept. |
Size of the problem on the estate (opensourcecobol4j a4cb106, independent Unicode-aware reading vs the master DB)
| suite | Japanese data names | correct | truncated | missing | Japanese sections/paragraphs missing | Japanese PROGRAM-IDs not refracted |
|---|---|---|---|---|---|---|
i18n_sjis (--source-encoding shift_jis) |
39 | 0 | 22 | 17 | 11/11 | 3/3 (+3 more excluded as "Statistical Anomaly") |
| cobol_utf8 | 34 | 0 | 22 | 12 | 16/16 | 6/6 |
| i18n_utf8 | 22 | 0 | 15 | 7 | 9/9 | 3/3 (+4 excluded) |
Decoding is not the cause. Every SJIS file was decoded shift_jis / declared. The loss happens in the name classes.
Minimal reproduction (origin/main 3f8bdb6)
mkdir -p estate
cat > estate/JPNAMES.cbl <<'COB'
IDENTIFICATION DIVISION.
PROGRAM-ID. JPNAMES.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 顧客レコード.
05 顧客番号 PIC 9(6).
05 X項目 PIC X(4).
05 FIXED_FLD PIC X(2).
PROCEDURE DIVISION.
主処理 SECTION.
MOVE 'ABCD' TO X項目.
DISPLAY X項目.
STOP RUN.
COB
cat > estate/JPPGM.cbl <<'COB'
IDENTIFICATION DIVISION.
PROGRAM-ID. 日本語のプログラム名.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-A PIC X(4) VALUE 'ABCD'.
PROCEDURE DIVISION.
DISPLAY WS-A.
STOP RUN.
COB
GITGALAXY_DISABLE_GIT_HISTORY=1 python -m gitgalaxy.galaxyscope estate --db-only --output out
sqlite3 out/estate_galaxy_master.db "select f.file_name, r.level_number, r.item_name, r.pic from record_data r join file_data f on f.id=r.file_id"
sqlite3 out/estate_galaxy_master.db "select f.file_name, c.class_name from class_data c join file_data f on f.id=c.file_id"
sqlite3 out/estate_galaxy_master.db "select func_name from function_data"Actual:
JPNAMES.cbl|5|X|X(4)
JPNAMES.cbl|5|FIXED|X(2)
JPPGM.cbl|1|WS-A|X(4)
---
JPNAMES.cbl|JPNAMES <- JPPGM.cbl has no class: never refracted
---
<- 主処理 missing
Expected: records 顧客レコード (01), 顧客番号 9(6), X項目 X(4), FIXED_FLD X(2); class 日本語のプログラム名; function 主処理.
Fix direction
The COBOL name classes (languages/cobol.py, mainframe_boundary.py and the other mainframe readers that share them) should accept the Unicode letters that identifiers.ID_CONTINUE already defines, the same way #3814 did for other languages. The fullwidth hyphen-minus forms (- U+FF0D, − U+2212) appear inside Japanese names in these tests (O−文字列, S-初期化). Downstream Java identifiers already keep Unicode (#3815).
Test material: i18n_sjis.src/user-defined-word.at, cobol_utf8.src/user-defined-word.at and program-id.at in opensourcecobol4j (GPL: use as a reference, do not vendor it).
🤖 Generated with Claude Code
Activity
Fix #3955: Expand COBOL identifiers to support international characte…
squid-protocol commentedon Sep 28, 2026
This has been fully addressed in PR #3967.
By upgrading our
NATIONALregex block to natively inherit UnicodeID_START, we not only flawlessly restored Japanese variables (Kanji, Katakana, Hiragana) but implicitly completely solved a massive blind spot regarding IBM Enterprise COBOL underscores (_).The engine now correctly maps fully-qualified variables like
COMPANY_PREFIXrather than truncating them. The Golden Master baselines have been regenerated and committed to reflect thousands of correctly expanded variables across the test estate.Fix #3998: no-scan lineage reads SELECT with the engine's reader (#3999)
fix: train -- #4305, #4351, #4353, #4355 (#4383)