Skip to content

det: HLASM + EXEC CICS front end lowers zECS ZECSNC to COBOL; ZECS002 refused by name (Part of #5859) - #6826

Merged
squid-shepherd[bot] merged 6 commits into
mainfrom
churn/5859-20261027T2200Z
Oct 27, 2026
Merged

squid-shepherd[bot] merged 6 commits into
mainfrom
churn/5859-20261027T2200Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5859. Assembler slice 1: an HLASM + EXEC CICS front end for the det translator. With it, zECS ZECSNC.asm is translated instead of refused whole.

Checklist: partial [c:e14a97c1] -- slice 1 of the assembler path. The front end lowers HLASM to COBOL (Design.md). ZECSNC is lowered and translated with 2 holes, both in det/cics.py option modelling. Left: 2a (those options, giving L1), 2b (an equivalence case, giving L2), 3 (ZECS002), and 4 (an interpreter cross-check).

c:f5d905de (ZUIDSTCK): already done. #5945 is closed, register X69 holds the assumption, and tests/equivalence/zecs-zecs001 exists. Nothing in this PR touches it. c:2083e51d (the ladder shows refused assembler programs separately): untouched.

What changed

  • gitgalaxy/tools/cobol_to_java/det/hlasm.py (new). lower_text lowers a command-level CICS assembler program to fixed-format COBOL, following the BLL precedent (X56).
    • Storage: DSECTs are laid out with HLASM alignment (gap FILLERs), 0CLn groups and EQU lengths. DFHEISTG becomes WORKING-STORAGE; the USING'd DFHEICAP DSECT becomes LINKAGE DFHCOMMAREA.
    • Registers are HL-Rn COMP-5 cells. BAS / BCR become return ids dispatched by GO TO DEPENDING ON, with an ASRA abend fallback.
    • The condition code is resolved statically, per POPS, for CLC / CLI / CH / OC. A logical high/low branch is refused (EBCDIC collating).
    • Everything outside the subset is refused by name. service_stub synthesizes the CICS service stub, since the forge makes none for .asm.
  • det/source.py. assembler_lowered: program_lines reads an accepted .asm as its lowering. A refused one keeps the scanner/det: detect and refuse by name macro-level CICS and CICS Assembler programs #5121 shape (<file>:<line>: CICS Assembler not supported (DFHEIENT): ...) and appends the lowering's reason.
  • tests/tools/det_survey.py. assembler_rows routes a lowered member through survey_program instead of writing a refusal row. survey_program writes the synthesized stub for an .asm program.
  • docs/language_status/hlasm_cics_design.md. The decision, IBM references, subset, storage model, CC rules, assumptions, oracle statement and remaining slices.
  • tests/cobol_mainframe/test_hlasm_lowering_5859.py. 33 tests in 0.3 s:
    • every CC outcome × mask for CLC / CLI / CH / OC;
    • STH sign wrap;
    • MVC displacement;
    • alignment, overlays and EQU;
    • BAS / BCR and sentence periods;
    • refusals by name;
    • the stub;
    • a corpus test (ZECSNC lowers; ZECS002 is refused at DC 08XL01'40').

The plan changed

  • The plan said ZECSNC would reach L1. It stays at L0, but the reason moves from "refused whole" to "2 holes left":

    • EXEC CICS ABEND ... NOHANDLE (line 103);
    • WRITE OPERATOR ... TEXTLENGTH ROUTECODES NUMROUTES EVENTUAL (line 260). cics.py models only plain TEXT (X32).

    Both need det/cics.py plus the stub, a 6th file over the cap, so they are slice 2a.

  • The CC is resolved statically (setter directly before the BC), not held in a CC cell.

  • No static read-before-write refusal. DFHEISTG's initial fill is a stated assumption instead.

  • A synthesized CICS stub was needed. Without one, det treats the program as non-CICS.

Gates

All run locally on the branch (selfscan venv, via heavy-run.sh where heavy):

  • Guard list plus tests/tools/: 3298 passed, 1 failed. The failure was test_the_inputs_cover_what_the_translator_imports: hlasm.py imported gitgalaxy.core.hlasm_cics, which the translator fingerprint does not read. Fixed by mirroring its two statement helpers in det (as cics_macro_level does). Re-run of that file plus the 5859, 5121 and 5158 tests: 152 passed.
  • time_ratchet.py check --times: 3322 tests checked, 0 over the limit. The new test takes 0.3 s.
  • audit_check.py: ruff, dead-key and ast-accuracy pass. One mypy finding (a loop variable reused across Item and str) is fixed; mypy_audit --ci is clean.
  • pr_gates.py --fast: 9/9 pass. --ratchets: 9 pass, 0 fail.
  • det_port.py check --work <fresh>: 180/180 ports unchanged.
  • Pinned ruff 0.17.1 on the changed files: hlasm.py, source.py and the test are clean. det_survey.py has no findings beyond main's own.
  • Golden masters: no engine/detector/prism change, so there is no bless.

Class / Sibling gaps

The class is assembler members in the burned estates. Only zECS has command-level CICS assembler (ZECSNC, ZECS002); both are covered here, as lowered or refused by name.

  • CardDemo app/asm/COBDATFT.asm, MVSWAIT.asm and maclib/*.mac are batch assembler CALLed from COBOL, with no EXEC CICS and no DFHEIENT. They are a different mechanism (CALL target, LE linkage) and not this front end's entry point; they stay refused / out of scope.
  • CBSA's only assembler-suffix member is src/base/asm_src/DFHNCOPT.assemble, a named-counter options table (a CICS table macro), with no DFHEIENT and no EXEC CICS. It is a resource definition, not a program, so it is not in this class.
  • GenApp, DBB MortgageApplication and async credit-card have no member with an assembler suffix (.asm .assemble .bal .hlasm .mac), checked over the corpora.

Remaining slices

  1. 2a: det/cics.py plus the stub and a register entry for ABEND NOHANDLE and the WRITE OPERATOR routing options. Gives ZECSNC L1.
  2. 2b: tests/equivalence/zecs-zecsnc/, with a lowering hook in equivalence_cics.py beside bll.lower_text and an X register entry ("the oracle runs the lowered program"). Gives L2.
  3. 3: ZECS002. Base-displacement operands; IC, SR, BCT, SLL, SLDL, STCM, TR, XC; duplicated X'40' data; EXEC CICS VERIFY.
  4. 4: an independent S/390-subset interpreter cross-checking the lowering.

Facts checked

  • det: CALL ZUIDSTCK stand-in for zECS ZECS001 (1 hole) -- the TOD as a stated input on both runtimes #5945 is closed; docs/language_status/register/X69.md and tests/equivalence/zecs-zecs001 exist.
  • ZECSNC's two holes and their lines come from the det survey of zecs (det_survey.py, kind cics, 54 statements, 2 holes). The other 5 zecs COBOL programs are unchanged (0 holes).
  • ZECS002's refusal text: ZECS002.asm:68: CICS Assembler not supported (DFHEIENT): outside the HLASM lowering's subset (#5859): DC 08XL01'40' at line 319; ....
  • test_det_cics_macro_refusal_5121.py and test_cics_census_assembler_5158.py pass unedited (42 passed).

Lessons for agents

  • A lowered COBOL paragraph must end in a period. Otherwise the det parser reads the next paragraph header as more GO TO operands (GO TO ['SYSDATE','SYSDATE'], "HOLE does not parse").
  • det treats a program as CICS only when its service stub holds runTask(CicsTask. A program the forge makes no stub for (an .asm) gets the non-CICS fallback, and every EXEC CICS becomes a hole with "no such item EIB...".
  • Never run ruff check --fix / ruff format over a whole pre-existing file that main leaves unformatted (tests/tools/det_survey.py). It drops # noqa comments and churns unrelated lines; reapply only your hunks.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 27, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 27, 2026 22:34
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 27, 2026 22:34
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab



SUBSET = frozenset({"B", "BC", "BCR", "BAS", "L", "LA", "ST", "STH", "CH", "CLC", "CLI", "MVC", "OC"})
_IGNORED = frozenset({"AMODE", "RMODE", "PRINT", "LTORG", "END", "EJECT", "SPACE", "TITLE"})
@squid-shepherd
squid-shepherd Bot merged commit bbaef53 into main Oct 27, 2026
94 of 95 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/5859-20261027T2200Z branch October 27, 2026 23:02
squid-shepherd Bot pushed a commit that referenced this pull request Oct 28, 2026
…rt of #5859) (#6879)

ZECSNC lowers and translates since #6826, so it is core work, not a held
member. ZECS002 stays listed apart until slice 3 lowers it.

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants