Skip to content

CBL / PROCESS compiler options and the DB2 DATE/TIME format (#3828) - #3887

Merged
squid-protocol merged 1 commit into
mainfrom
fleet/3828-regional-options
Sep 27, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fleet/3828-regional-options

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3828 (epic #3819, the Western Europe region).

A German, Nordic or French shop may compile with INTDATE(LILIAN) and run DB2 with DATE format EUR. Neither was read: FUNCTION INTEGER-OF-DATE counts from 1601-01-01 (ANSI) or from 1582-10-15 (LILIAN), and a DB2 DATE fetched into a PIC X(10) on an EUR subsystem reads 26.09.2026, but the Java assumed ISO.

What changed

  • Engine fact compiler_options (core/compiler_options.py -> compiler_options_data), wired the same way Currency signs in PICTURE: £ € ¥ and CURRENCY SIGN / PICTURE SYMBOL mis-size or drop fields; the answer key shares the blind spot #3820 wired SPECIAL-NAMES: galaxyscope, record_keeper, the delta-scan rehydrator, galaxy_ir (EngineFile.compiler_options, EngineFile.compiler_option(name)), the audit JSON, the LLM brief (semantic options only) and the fact-channel guide.
    • Each row has four fields:
      • the option's full name, with abbreviations spelled out (AR(E) -> ARITH EXTEND, YW -> YEARWINDOW, NOCURR -> NOCURRENCY);
      • its parenthesised value as written ('SP,EDF' stays whole);
      • the option as written;
      • the line.
    • Cards may be comma- or space-separated and span several cards. A card counts only where the compiler reads one: in the leading block of the file, or after END PROGRAM. So PERFORM / PROCESS THRU ... is not a card. Columns 73-80 are ignored.
    • No rule key was added, so the strict schema tests are untouched.
  • culture.db2_date_format is now wired (the TODO is removed). A generated repository/db2/Db2Dates sits beside the DB2 repositories.
    • Output formats: EUR dd.mm.yyyy / hh.mm.ss, USA mm/dd/yyyy / hh:mm AM, ISO yyyy-mm-dd / hh.mm.ss, JIS yyyy-mm-dd / hh:mm:ss. A TIMESTAMP is always yyyy-mm-dd-hh.mm.ss.nnnnnn.
    • The parse methods accept every DB2 input form, as DB2 does, and reject impossible dates.
    • LOCAL (an installation exit) refuses to format, with a TODO, until the exit's patterns are set. It does not guess.
    • Each repository's Javadoc names its DATE/TIME columns that need this conversion. port_runner shows Db2Dates to the agent.
  • Port tickets:
    • Two new PORTING_RULES: DB2 character dates via Db2Dates, and the INTDATE day zero (1600-12-31 ANSI vs 1582-10-14 LILIAN, 6653 days apart).
    • A new compiler_options field (JSON and a Markdown table) carrying the program's cards.
    • One extra rule per non-default semantic option: INTDATE(LILIAN), TRUNC(BIN|OPT), ARITH(EXTEND), NUMPROC(PFD).
  • Equivalence harness:
    • The program's own CBL / PROCESS cards and a case's "compiler_options": ["TRUNC(BIN)"] become cobc flags, on both the batch and the CICS side. The case's list stands for the compile step's PARM, so the program's cards override it, as on z/OS.
    • The cards are blanked in the staged source. GnuCOBOL 3.1.2 rejects CBL with an error and ignores PROCESS.
    • A case's "culture" (e.g. {"db2_date_format": "eur"}) reaches the Java side's generated config.
    • With no cards and no case options, the staged source and the flags are byte-identical to before.

Not done, and why

  • GnuCOBOL has no INTDATE. I checked cobc --help in the harness image, GnuCOBOL 3.1.2: its INTEGER-OF-DATE is always ANSI (the probe returns 155497 for 2026-09-26). It also has no ARITH(EXTEND), NUMPROC or TRUNC(OPT) switch. A case needing any of these now fails with UnsupportedOption instead of passing unfaithfully. Only TRUNC(BIN) has an equivalent (-fnotrunc, verified in an E2E test: a PIC S9(4) COMP holds 10000). The LILIAN behaviour is covered by the porting rule and a unit test of the day arithmetic, not by the harness.
  • DB2 on the COBOL side: the harness has no DB2, so the date format reaches only the Java side's config.
  • Options from outside the source (the compile step's PARM in JCL, installation defaults, OPTFILE) are not read. The rule says so.
  • PostgreSQL DateStyle, marked "plausible" in the issue: not probed.
  • YEARWINDOW is recorded, but it only matters under DATEPROC (removed in Enterprise COBOL 5+), so no rule or flag is added for it.

Golden masters and snapshots

  • The golden masters gain one new compiler_options.json per mode, identical in both. It holds 43 crucible programs with CBL / PROCESS cards: CICS / SQL / NODYNAM / NSYMBOL(NATIONAL) / TRUNC(STD) in CBSA, GenApp and zECS, and CODEPAGE(1140) / XMLPARSE in che4z. Nothing else moves.
  • The refraction snapshots, both the excerpts and all six full corpora, were re-run with update and nothing moved: they do not include the DB2 repositories or the tickets.

Gates

  • tests/tools/pr_gates.py --e2e: lint, audits, secrets, xray, gauntlet, golden and the suite (784s, with EQUIVALENCE_E2E=1) all PASS. The full run hit my 10-minute foreground limit, so the suite gate ran on its own.
  • After the final rebase: lint, audits, secrets, xray, gauntlet and golden PASS again, plus the new and DB2 tests.
  • java_target_matrix.py --scan --only default mysql on a DB2 estate with CBL INTDATE(LILIAN): PASS. The generated Db2Dates is also compiled and run with JDK 17 for all five formats in tests/cobol_mainframe/test_regional_options.py.

🤖 Generated with Claude Code

A Western European shop may compile with INTDATE(LILIAN) and run DB2 with
DATE format EUR. Neither was read.

- Engine: new per-file fact `compiler_options` (core/compiler_options.py ->
  compiler_options_data): each CBL / PROCESS card option with its full name
  (AR -> ARITH, YW -> YEARWINDOW ...), its parenthesised value and the option
  as written, read only where the compiler reads a card (the leading block, or
  after END PROGRAM). Wired through galaxyscope, record_keeper, the delta-scan
  rehydrator, galaxy_ir (EngineFile.compiler_options / compiler_option()), the
  audit JSON and the LLM brief (semantic options only).
- Java: culture.db2_date_format now drives a generated Db2Dates beside the DB2
  repositories (EUR dd.mm.yyyy / hh.mm.ss, USA mm/dd/yyyy / hh:mm AM, ISO, JIS;
  TIMESTAMP yyyy-mm-dd-hh.mm.ss.nnnnnn; parsing accepts every DB2 input form;
  LOCAL refuses until the exit's patterns are set). Repositories name the
  DATE/TIME columns that need it. TODO(#3828) removed.
- Port tickets: two porting rules (DB2 character dates; INTDATE day zero),
  the program's compiler_options, and a rule per non-default semantic option
  (INTDATE(LILIAN), TRUNC(BIN|OPT), ARITH(EXTEND), NUMPROC(PFD)).
- Harness: the program's cards (blanked: GnuCOBOL rejects CBL) and a case's
  `compiler_options` become cobc flags (TRUNC(BIN) -> -fnotrunc); options
  GnuCOBOL 3.1 cannot honour (INTDATE(LILIAN), ARITH(EXTEND), NUMPROC(PFD),
  TRUNC(OPT)) stop the run instead of passing unfaithfully. A case's `culture`
  reaches the Java side's config. Defaults unchanged.

Golden masters: one new compiler_options.json per mode, 43 crucible programs
with CBL / PROCESS cards; nothing else moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 0fa306d into main Sep 27, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the fleet/3828-regional-options branch September 27, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regional compiler and DB2 options not captured: INTDATE, YEARWINDOW, ARITH, TRUNC, NUMPROC, DSNHDECP DATE/TIME format, DECIMAL=COMMA

1 participant