Skip to content

Mainframe fact channel: file definitions -- SELECT keys and VSAM defines (#3455) - #3470

Merged
squid-protocol merged 1 commit into
mainfrom
feat/vsam-defs-3455
Sep 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feat/vsam-defs-3455

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3455. Part of #3445.

What

Two new per-file channels in core/file_control.py:

  • file_control_data (COBOL): each FILE-CONTROL SELECT, with:

    • organisation and access mode;
    • RECORD, ALTERNATE (with WITH DUPLICATES) and RELATIVE keys, and FILE STATUS;
    • the COPY members inside the file's FD entry, for a record that lives wholly in a copybook (FD CUSTOMER-INPUT. COPY CVCUS01Y.).
  • vsam_define_data (JCL): each IDCAMS DEFINE CLUSTER / ALTERNATEINDEX / PATH in in-stream SYSIN, with:

    • name and organisation (INDEXED, NUMBERED, NONINDEXED, LINEAR);
    • KEYS(l o) and RECORDSIZE;
    • AIX RELATE, UNIQUEKEY and UPGRADE, and PATH PATHENTRY;
    • the EXEC step.

    Abbreviations (DEF, CL, AIX, RECSZ, PENT) and - continuations are read.

GalaxyIR.vsam_files() handles each keyed SELECT:

  1. It places the key at its byte offset and length in the FD record. The record is COPY-expanded, and a group key covers the span of its fields.
  2. It follows the DD through the job lineage to the dataset, then to its CLUSTER. A PATH resolves to the AIX it opens.
  3. It compares the two keys and reports the result as key_match, along with any CSD FILE on the same dataset.

CardDemo findings

31 keyed SELECTs:

  • 20 match their cluster's KEYS exactly, including the XREF alternate key against its AIX KEYS(11 25).
  • 9 have no job in the repo binding their DD, so there's nothing to compare against.
  • 2 (CBEXPORT / CBIMPORT) key the file on EXPORT-SEQUENCE-NUM. That's a WORKING-STORAGE item, not a field of the FD record, which COBOL doesn't allow. It's reported as key_in_record: False.

Ground truth

  • Independent readers: add-file-defs.
  • New scored fields: file control and VSAM defines, drafted.
  • Result: the engine matches the key exactly: CardDemo 54/54 SELECTs and 24/24 defines, CBSA 1/1 and 2/2, zopeneditor 12/12.

Checks

  • Golden masters: only new File Control / VSAM Defines blocks.
  • Tests: full suite passes locally (11,206 passed). The ruff, mypy, dead-key and X-Ray checks are clean; the dead-key audit allowlists the IDCAMS parameter words parsed from JCL.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

…nes (#3455)

dataset_data said which DD a SELECT is assigned to and how it is opened, not
how the file is organised or keyed, and nothing recorded the VSAM cluster the
DD points at -- so a migration could not check a program's RECORD KEY against
the cluster's key.

New per-file channels (core/file_control.py):
- file_control_data (cobol): each FILE-CONTROL SELECT -- organisation, access
  mode, RECORD / ALTERNATE (+WITH DUPLICATES) / RELATIVE keys, FILE STATUS,
  and the COPY members inside the file's FD entry (a record that lives wholly
  in a copybook: `FD CUSTOMER-INPUT. COPY CVCUS01Y.`).
- vsam_define_data (jcl): each IDCAMS DEFINE CLUSTER / ALTERNATEINDEX / PATH
  in in-stream SYSIN -- name, organisation (INDEXED / NUMBERED / NONINDEXED /
  LINEAR), KEYS(l o), RECORDSIZE, AIX RELATE / UNIQUEKEY / UPGRADE, PATH
  PATHENTRY, the EXEC step; abbreviations (DEF, CL, AIX, RECSZ, PENT) and
  `-` continuations read.

galaxy_ir: EngineFileControl / EngineVsamDefine and GalaxyIR.vsam_files(): each
keyed SELECT's key placed at its byte offset / length in the FD record
(COPY-expanded, group keys spanned), its DD followed through the job lineage
to the dataset, the dataset to its CLUSTER (a PATH to the AIX it opens), and
the keys compared (key_match), plus any CSD FILE on the dataset.

CardDemo: 31 keyed SELECTs -- 20 match their cluster's KEYS exactly (incl. the
XREF alternate key vs its AIX KEYS(11 25)); 9 have no job in the repo binding
their DD; 2 (CBEXPORT / CBIMPORT) key the file on EXPORT-SEQUENCE-NUM, a
WORKING-STORAGE item that is not a field of the FD record -- a definition
COBOL does not allow, reported as key_in_record False.

Ground truth: independent readers (add-file-defs) and two scored fields,
"file control" and "VSAM defines" (drafted). Engine matches the key exactly:
CardDemo 54/54 SELECTs + 24/24 defines, CBSA 1/1 + 2/2, zopeneditor 12/12.
Golden masters: new File Control / VSAM Defines blocks only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: 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

@squid-protocol
squid-protocol merged commit 90d1ed4 into main Sep 24, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the feat/vsam-defs-3455 branch September 24, 2026 11:03
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: VSAM file definitions: ORGANIZATION, ACCESS MODE, RECORD KEY

1 participant