Repository navigation
#3826: the zoned sign table follows the data's code page - #3842
Merged
Merged
Conversation
Zoned-decimal overpunch was hard-wired to the US table ({ABCDEFGHI / }JKLMNOPQR). Under
a national EBCDIC page the sign bytes 0xC0 / 0xD0 are other letters (cp273 ä/ü, cp278
ä/å, cp277 æ/å, cp280 à/è, cp297 é/è), so the generated Java codec threw on every
value ending in 0.
- java_target: `data.code_page` (default cp037), validated when the config loads;
zoned_sign_characters() is the one definition -- Python codecs where they exist, and
the national zero signs (IBM CDRA) for cp277/278/280/284/285/297/1047, which Python
ships no codec for
- repository forge: CobolRecords' POSITIVE / NEGATIVE come from it, non-ASCII escaped
(ä) so the Java source stays ASCII; cp037 output is byte-identical
- equivalence harness: decode_field / encode_field / the input generator take the
code page (a case may declare "code_page"), using the same table (cached)
- tests: 20 distinct signs on ten code pages, cp273 +100.00 round trip, generated
CobolRecords for cp273, cp037 unchanged, unknown page fails at config load
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3826 (epic #3819).
Why
Zoned-decimal sign overpunch was hard-wired to the US table (
{ABCDEFGHI/}JKLMNOPQR). Under a national EBCDIC code page, the sign bytes 0xC0 / 0xD0 are that page's own letters. So the generated Java codec threw on every value ending in 0: cp273 Germanä/ü, cp278 Swedish/Finnishä/å, cp277æ/å, cp280à/è, cp297é/è.Found along the way: Python ships no codec for cp277, cp278, cp280, cp284, cp285, cp297 or cp1047. A table built from
bytes.decode()alone silently can't handle the Nordic pages at all. That's the family behind the ÆØÅ bug (#3520).What
java_target's newdata.code_page(defaultcp037) is checked when the config loads.zoned_sign_characters(). It uses Python's codec where one exists. Otherwise it uses the national zero signs from IBM CDRA; in every Latin EBCDIC page, 0xC1–C9 / 0xD1–D9 are A–I / J–R.CobolRecordstakesPOSITIVE/NEGATIVEfrom that definition. Non-ASCII characters are escaped (ä) so the Java source stays ASCII. cp037 output is byte-identical.decode_field,encode_fieldand the input generator take the code page, and a case may declare"code_page". They use the same table, cached.Tests (
tests/cobol_mainframe/test_code_page_overpunch.py)CobolRecordsfor cp273 carriesä/ü.Verified
test_code_page_overpunch,test_equivalence,test_equivalence_inputs,test_java_targetandtest_vsam_repositories: 63 passed, 2 skipped.Drafted by a sandboxed Gemini fleet agent. In review I added the config-load check, the cache, the non-Python code pages (the agent's tests had skipped them), and a cleaned-up test file.
🤖 Generated with Claude Code
https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g