Skip to content

Fix #4004: CICS harness models LINK with program levels and a by-reference COMMAREA - #4018

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4004-link
Sep 29, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4004-link

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4004
Part of #3989 (phase 3, lane B)

#4016 (#4003) has merged. This branch is rebased on main, which includes lane A's #4009, #4010 and #4011, and its baseline and report are regenerated.

What

One process per task. The COBOL side now runs a whole task in one GnuCOBOL process instead of one process per XCTL hop:

  • The case's programs are compiled with two generated units:
    • GGTASK, the driver: the EIB (now including EIBTRMID) and the first program.
    • GGCRUN, a RECURSIVE dispatcher: it runs a level's program, then any XCTL target, and CANCELs each program after its run so the next run starts with fresh WORKING-STORAGE, as a new CICS program instance does.
  • The GnuCOBOL mechanics were verified before use: recursive LOCAL-STORAGE, CANCEL of static-linked programs, and a NULL COMMAREA address.

LINK (IBM, EXEC CICS LINK):

  • GGCLINK records the event. It raises LENGERR RESP2 11 when LENGTH is outside 0–32763, and PGMIDERR RESP2 1 when the CSD does not define the program. The runner writes the CSD's programs to programs.cfg; per SPEC §2, program autoinstall is off.
  • On NORMAL the target runs at the next level on the caller's own storage: "the address of the area is passed", so the callee's writes are the caller's. Its EIBCALEN is the LENGTH given, or 0 without a COMMAREA.
  • Per-level handlers: each level starts with an empty handler table ("not inherited by the linked-to program"). The caller's table is in force again on return ("restored on return to the linking program").
  • RETURN at level 2 or deeper returns to the caller. Its event carries caller_commarea: the LINK COMMAREA as the caller now sees it. A GOBACK counts as a RETURN.
  • Abends across levels: when the exit is at a higher level, each lower level leaves, and GGCLRET at the exit's level GOes TO the exit label (the CICS harness: condition machinery (HANDLE/IGNORE CONDITION, RESP/NOHANDLE, HANDLE ABEND, PUSH/POP HANDLE) #4003 machinery).

Other stub and translator changes:

  • Events: every stub event names its issuing program (pgm=).
  • Refusals: SYSID, TRANSID, SYNCONRETURN, CHANNEL, INPUTMSG and DATALENGTH on LINK are refused by name.
  • Java (generated CicsTask):
    • LINK API: link(program, commarea, length) and link(program). The callee is a CicsTask of its own at level+1 that shares the task's events, terminal and TS store, and it gets the caller's COMMAREA object itself.
    • Level accessors: level(). EIBCALEN at a LINKed level is CicsTask event model: SEND TEXT length/options, RECEIVE-MAP event, COMMAREA length (Java side, 28+ cells) #4009's eibcalen(), which gives the LINK LENGTH, or 0 without a COMMAREA.
    • XCTL below level 1 runs its target at the same level.
    • Hooks: run(program) runs level 1 plus its XCTL chain. withPrograms(Programs) supplies defined and run. withSnapshot copies a COMMAREA when an event records it, because a LINK area changes later. withProgram sets the level's program, and each event names its issuer.
    • Java driver: runs tasks through CicsTask.run. LINK and XCTL reach the services' runTask.
  • Forge: programs reached only by LINK or XCTL (CASUB, HCSUB, CardDemo-style sub-programs) now also get runTask(CicsTask), with a Javadoc that says they run at a LINK/XCTL level. The harness can drive them now.
    • This is an intended generated-output change for CICS corpora: one more stub method per such service, and CicsTask.java is emitted whenever there is a CICS program.
    • test_cics_endpoints is updated to match.

Cells (side × status)

side before pass/fail/unsupported after
engine-facts 10 / 0 / 0 10 / 0 / 0
forge-compile 10 / 0 / 0 10 / 0 / 0
cobol-stub 6 / 1 / 30 15 / 1 / 21
java 0 / 37 / 0 0 / 37 / 0
  • ca-link-lengths (4 scenarios) now passes: short-100, long-500 (the callee's writes land in the caller's WS-AFTER), no-commarea and undefined-program (PGMIDERR RESP2 1 under RESP).
  • hc-abend-link (5 scenarios) now passes. It covers handlers not inherited and then restored, an AEYH at level 2 taken by the level-1 exit with the callee's COMMAREA writes still visible, the callee's own exit followed by RETURN, and PUSH/POP.

Tests

  • Translator: LINK with and without a COMMAREA and the GGCRUN/GGCLRET/GO TO sequence; the generated dispatcher and driver.
  • Runner: stub lines to events for LINK, RETURN level 2 (with and without a COMMAREA), NOPROGRAM and pgm=; the Java LINK and level-RETURN events.
  • javac: a test drives CicsTask.link through a by-reference StringBuilder, covering EIBCALEN, PGMIDERR, LENGERR, XCTL at level 2, implicit RETURN, and the terminal read once per task.
  • End to end: the EQUIVALENCE_E2E=1 fixture run passes, and CardDemo account view still passes 9/9 events.

Audits: ruff, mypy and dead-key show no new findings. Touched files are formatted.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 3 commits September 29, 2026 15:19
…rence COMMAREA

- A task is one process: a generated driver (GGTASK) names the first
  program, and GGCRUN (RECURSIVE, generated per case) runs each level's
  program and whatever it XCTLs to, CANCELing it after each run so the next
  one starts with fresh WORKING-STORAGE.
- LINK: GGCLINK checks (LENGERR RESP2 11 outside 0-32763, PGMIDERR RESP2 1
  for a program the CSD does not define, programs.cfg) and records the
  event; the target then runs at the next level on the caller's own storage,
  with EIBCALEN = LENGTH (0 without COMMAREA). Each level has its own
  handler table, fresh on program entry and the caller's again on return.
- RETURN below level 1 returns to the linking program; its event carries the
  LINK COMMAREA as the caller now sees it. A GOBACK is a RETURN.
- An abend whose exit is at a higher level unwinds: each lower level leaves,
  and GGCLRET at the exit's level GOes TO its label.
- Every stub event names its issuing program (pgm=).
- CicsTask: link / level / linkLength / run / withPrograms / withProgram /
  withSnapshot; below level 1 an XCTL runs its target at the same level.
  The Java driver runs tasks through CicsTask.run and records events with
  their issuer and COMMAREA snapshots.
- Forge: programs reached only by LINK / XCTL get runTask(CicsTask) too, so
  the harness can drive them at their level.

cobol-stub: ca-link-lengths (4) and hc-abend-link (5) now pass.

Part of #3989.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
@squid-protocol
squid-protocol marked this pull request as ready for review September 29, 2026 19:19
@squid-protocol
squid-protocol merged commit 6a60531 into main Sep 29, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4004-link branch September 29, 2026 19:30
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.

CICS harness: LINK with by-reference COMMAREA and program levels (unlocks through 18 cobol-stub cells)

2 participants