Skip to content

Mainframe fact channel: batch CALL USING contracts (#3454) - #3475

Merged
squid-protocol merged 2 commits into
mainfrom
feat/call-using-3454
Sep 24, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
feat/call-using-3454

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3454. Part of #3445. Stacked on #3474; GitHub retargets it to main when #3474 merges.

#3355 matched CICS COMMAREAs to the callee's DFHCOMMAREA. A batch CALL 'X' USING A B C passes its data positionally to the callee's PROCEDURE DIVISION USING P Q R, and neither side was recorded, so an arity or length mismatch was invisible.

What

core/call_using.py:

  • Each CALL's USING list, by position → call_site_data.using_args.
    • Reading rules: BY CONTENT / BY VALUE prefix the items that follow; A OF B is kept; subscripts are dropped; ADDRESS OF, LENGTH OF, OMITTED and literals are kept as written.
    • The list ends at RETURNING, ON, NOT, END-CALL, a period, or the next verb.
    • It's a column, like Engine: COMMAREA contract fact (LINK/XCTL COMMAREA → callee LINKAGE) #3355's COMMAREA, and it's healed onto older tables. It's set only on a CALL that has a USING list, so every other row keeps its shape.
  • Each PROCEDURE DIVISION [USING] and ENTRY 'X' [USING] → entry_point_data.
  • Sequence fields are blanked once per file. A first cut blanked a slice, which misplaced columns 73–80.

GalaxyIR.call_contracts() pairs each CALL with its callee's entry point: the ENTRY the target names, otherwise the PROCEDURE DIVISION.

  • status: paired, arity_mismatch, callee_unresolved, callee_no_using, or caller_no_using.
  • Per position: the argument's and the parameter's byte length (from record_layout, COPY-expanded) and length_match.

Corpora

  • CardDemo:
    • CBSTM03A → CBSTM03B: 13 sites, 1040 = 1040 bytes.
    • CORPT00C / COTRN02C → CSUTLDTC: 10/10/80 = 10/10/80 bytes.
    • The other 43 CALLs go to LE and MQ services outside the repo.
  • zopeneditor: SAM1 → SAM2, with 4 and 5 arguments.

Ground truth

  • Independent reader: add-call-using.
  • New scored field: CALL USING, drafted.
  • Result: the engine matches the key exactly: CardDemo 71/71, CBSA 22/22, zopeneditor 5/5.

Checks

  • Golden masters: a USING field on 227 call sites (verified purely additive: nothing removed or changed), plus new Entry Points blocks.
  • Tests: full suite passes locally (11,227 passed). The ruff, mypy, dead-key and X-Ray checks are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Base automatically changed from feat/census-file-sections to main September 24, 2026 12:47
squid-protocol and others added 2 commits September 24, 2026 08:49
#3355 matched CICS COMMAREAs to the callee's DFHCOMMAREA; a batch
`CALL 'X' USING A B C` passes its data positionally to the callee's
`PROCEDURE DIVISION USING P Q R`, and neither side was recorded, so an arity or
length mismatch was invisible.

core/call_using.py:
- a CALL's USING list, by position (BY CONTENT / BY VALUE prefix the items that
  follow, `A OF B` kept, subscripts dropped, ADDRESS OF / LENGTH OF / OMITTED /
  literals as written), ending at RETURNING / ON / NOT / END-CALL / a period /
  the next verb -> call_site_data.using_args (a column, like #3355's COMMAREA;
  healed onto older tables; only on a CALL that has one, so every other row
  keeps its shape);
- each PROCEDURE DIVISION [USING] and ENTRY 'X' [USING] -> entry_point_data.
Sequence fields are blanked once per file (a slice would misplace cols 73-80).

galaxy_ir: EngineCall.using_args, EngineEntryPoint / EngineFile.entry_points,
and GalaxyIR.call_contracts(): each CALL paired with its callee's entry (the
ENTRY the target names, else the PROCEDURE DIVISION) -- status paired /
arity_mismatch / callee_unresolved / callee_no_using / caller_no_using -- and
per position the argument's and parameter's byte length (record_layout,
COPY-expanded) and length_match.

CardDemo: CBSTM03A -> CBSTM03B (13 sites, 1040 = 1040 bytes), CORPT00C /
COTRN02C -> CSUTLDTC (10/10/80 = 10/10/80); the other 43 CALLs go to LE / MQ
services outside the repo. zopeneditor: SAM1 -> SAM2 (4 and 5 arguments).

Ground truth: an independent reader (add-call-using) and a scored field "CALL
USING" (drafted). Engine matches the key exactly: CardDemo 71/71, CBSA 22/22,
zopeneditor 5/5. Golden masters: a USING field on 227 call sites (purely
additive) and new Entry Points blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
…#3478)

IMS database calls were invisible: nothing said which programs read or update
which IMS segments.

core/dli_calls.py: one row per EXEC DLI command (the command, PCB(...), each
SEGMENT(...) of a path call, INTO / FROM, WHERE(...), SCHD PSB((name))) and per
CALL 'CBLTDLI' / 'AIBTDLI' (function operand, PCB mask, I/O area, SSAs -- read
with the #3454 USING reader), operands as written -> dli_call_data.

galaxy_ir: EngineDliCall / EngineFile.dli_calls and
- ims_calls(): a CBLTDLI function code resolved through its data item's VALUE
  (FUNC-GU lives in a copybook) and each SSA decoded from its group's
  COPY-expanded VALUEs -- segment name, `(FIELD OP` qualification or `*`
  command codes; EXEC WHERE clauses paired with their segments;
- ims_segment_access(): the program x segment matrix (the IMS counterpart of
  sql_table_access). A path call acts on its last segment and reads the
  parents it positions through.

CardDemo: 35 calls over PAUTSUM0 / PAUTDTL1 in 7 programs -- e.g. COPAUA0C
reads / updates / inserts PAUTSUM0 and inserts PAUTDTL1 under it; CBPAUP0C
reads and deletes both; DBUNLDGS reads both and ISRTs its GSAM PCBs (no SSA).

Ground truth: an independent reader (add-dli) with its own copybook lookup and
PIC-width VALUE decoding, and two scored fields, "DL/I calls" and "IMS segment
access" (drafted). Engine matches the key exactly: CardDemo 35/35 calls and
20/20 segment accesses (no IMS in CBSA or zopeneditor). Golden masters
unchanged (no IMS in the crucible corpus). PSB / DBD generation sources are not
scanned yet; follow-up issue.


Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

Co-authored-by: Claude Opus 5.5 <[email protected]>
@squid-protocol
squid-protocol merged commit 42e4a71 into main Sep 24, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the feat/call-using-3454 branch September 24, 2026 13:02
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.

Mainframe fact channel: batch CALL USING parameter contracts

1 participant