Skip to content

#3833: porting rules for calendars (java.time, Locale.ROOT, Monday = 1) and LINE SEQUENTIAL files - #3895

Merged
squid-protocol merged 3 commits into
mainfrom
fleet/3833-rules
Sep 27, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fleet/3833-rules

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3833 (the "Calendars" and "LINE SEQUENTIAL" bullets).

What changed

gitgalaxy/tools/cobol_to_java/cobol_to_java_port_tickets.py:

  • Calendar rule in PORTING_RULES, placed before the MainframeClock rule. Dates and times go only through java.time (LocalDate / LocalDateTime / LocalTime / DateTimeFormatter) with Locale.ROOT, in ISO chronology. It forbids Calendar.getInstance(), new GregorianCalendar(), SimpleDateFormat and WeekFields.of(Locale.getDefault()), and gives the reasons: th_TH Buddhist era 2569, ja_JP_JP imperial calendar, US Sunday-first weeks. It states that FUNCTION DAY-OF-WEEK / ACCEPT ... FROM DAY-OF-WEEK are Monday = 1 ... Sunday = 7, which is DayOfWeek.getValue(), and cites Smaller cultural assumptions: calendars/week start, ETL unpacker cp037+float, LINE SEQUENTIAL, national-use chars § Ñ #3833.

  • LINE SEQUENTIAL rule, conditional. The ticket already lists the program's files: the skeleton's file_control section (engine organization per SELECT) reaches facts.sections.file_control. The new line_sequential_rules(file_control) adds one rule when any SELECT is LINE SEQUENTIAL. The rule names those files, says the RECFM=FB rule does not apply to them, and spells out the format:

    • read one record per line and pad a short line with spaces;
    • on write, strip trailing spaces and end each line with \n, or \r\n when the estate runs on Windows.

    The RECFM=FB rule stays word for word, since the program may also have plain SEQUENTIAL files. In the ticket Markdown, such a program also gets a ## Files (FILE-CONTROL) table (line, file, ASSIGN, organization, and SEQUENTIAL (default) where the clause is absent).

  • A program with only SEQUENTIAL / INDEXED files gets exactly today's rules and Markdown. The test pins rules == PORTING_RULES.

Tests

tests/cobol_mainframe/test_port_rules_culture.py builds tickets with a real scan, refractor and cobol-to-java run, like test_port_tickets.py:

Not done, and why

  • Engine defect found (not fixed; this PR's scope excludes engine parsing). core/file_control.py reads ORGANIZATION IS LINE SEQUENTIAL and ORGANIZATION LINE SEQUENTIAL correctly. The ORGANIZATION keyword is optional in COBOL, though, and SELECT B ASSIGN TO 'b.txt' LINE SEQUENTIAL. is recorded as SEQUENTIAL: the bare-organization branch sees SEQUENTIAL preceded by LINE. Such a program gets no LINE SEQUENTIAL rule until that is fixed. It needs a follow-up in _one_select, and golden masters may move.
  • There is no estate-platform setting in the target config, so the rule states both terminators instead of choosing one. A culture/platform key would be a separate change.

Gates

python tests/tools/pr_gates.py --fast passed 5/5 (lint, audits, secrets, xray, gauntlet). --only golden and --only suite passed as separate runs (219s and 882s). No golden masters, baselines or refraction snapshots moved. After merging origin/main, ruff format, ruff_audit --ci and mypy_audit --ci are clean. The brief's set also passes: test_port_rules_culture, test_port_tickets, test_batch_jobs, plus test_regional_options and test_key_collation, which index PORTING_RULES.

🤖 Generated with Claude Code

…1) and LINE SEQUENTIAL files

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

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.

1 participant