Skip to content

Currency signs in PICTURE: £ € ¥ and CURRENCY SIGN / PICTURE SYMBOL mis-size or drop fields; the answer key shares the blind spot #3820

Closed

Description

@squid-protocol

What: Only $ is recognised as a currency symbol, and no code parses SPECIAL-NAMES CURRENCY SIGN IS.

  • On CP285 (UK), byte 0x5B (the default currency sign) arrives as £, so an ordinary UK PIC $$$9.99 reads PIC £££9.99.
  • Other cases: euro €, yen ¥, and multi-character strings (CURRENCY SIGN IS 'EUR ' WITH PICTURE SYMBOL 'U').

Where:

  • gitgalaxy/core/mainframe_boundary.py:312: _PIC_CLAUSE uses the character class [-A-Z0-9(),.$/*+].
    • PIC £££9.99. yields no PIC, so the item becomes a PIC-less group with an unknown width.
    • PIC 9(5)€. yields 9(5): a 6-byte field becomes 5 bytes.
  • tests/tools/cobol_answer_key.py:149 (_DD_PIC) and :5794 have the same class.
  • galaxy_ir._elementary_bytes counts one byte per position, which is wrong for a multi-character currency string.

Impact:

  • Wrong Java: every later field gets the wrong offset in fromRecord/toRecord.
  • Harness false pass: layout_fields is built from the same reader, and diff_records compares only the listed fields, so bytes past an under-counted layout are never compared.

Test:

  • 05 A PIC X(3). 05 AMT PIC £££,££9.99. 05 B PIC X(4). with CURRENCY SIGN IS '£'. Expected: AMT at offset 3, width 10; B at offset 13.
  • A second variant with 'EUR ' WITH PICTURE SYMBOL 'U'.
  • A deliberately corrupted B must be reported.

Fix:

  • Parse SPECIAL-NAMES (CURRENCY SIGN, PICTURE SYMBOL, DECIMAL-POINT) into a per-program fact.
  • Read a PIC as \S+ minus the terminating period, and size currency positions from the declared currency string.
  • In the harness, compare whole-record bytes too, or fail when the layout width ≠ reclen.

Found by a cultural-assumptions audit (2026-09-26): confirmed in code or by probe (JDK 17 locales, IBM code-page decoding, the harness's GnuCOBOL image) unless marked plausible.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    core-engine
    legacy-modernization
    priority: high
    on Sep 26, 2026
  2. added a commit that references this issue on Sep 27, 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

    bugcore-enginelegacy-modernizationpriority: high

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions