Skip to content

Refraction DAG architect: multi-mode OPEN assigns the first mode to every file, so no program ever has an output (all JCL DDs DISP=SHR) #3204

Closed

Description

@squid-protocol

Found by the #3120 differential. extract_lineage (gitgalaxy/tools/cobol_to_cobol/cobol_dag_architect.py) parses an OPEN statement with

re.finditer(r"OPEN\s+(INPUT|OUTPUT|I-O|EXTEND)\s+([^.]+)\.", safe_content)

That takes the first mode only and assigns it to every file up to the period. COBOL allows several modes in one OPEN:

           OPEN INPUT  TRANSACTION-FILE
                       CUSTOMER-FILE
                OUTPUT CUSTOMER-FILE-OUT
                       REPORT-FILE.

(zopeneditor SAM1.cbl:357). The result is inputs = {CUSTFILE, CUSTOUT, CUSTRPT, TRANFILE} and outputs = {}. The mode keyword OUTPUT is itself treated as a file token and ignored.

Effect

  • Both corpora (zopeneditor, CBSA) report zero outputs for every program. So:
    • generate_zero_trust_jcl gives every DD DISP=SHR, never (NEW,CATLG,DELETE). The "zero-trust" JCL for SAM1 opens its two output files shared.
    • The DAG's topological sort has no producer edges, so the execution order is arbitrary.
  • analyze_cobol_intent's SELECT regex is separate and fine here. The bug is only the OPEN-mode split.

Fix: tokenise the operand list and switch mode at each INPUT|OUTPUT|I-O|EXTEND keyword. Add the SAM1 shape as a test in tests/cobol_mainframe/test_cobol_dag_architect.py. The engine-side alternative (named OPEN-mode extraction) is filed separately.

Activity

  1. added
    bug
    legacy-modernization
    on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglegacy-modernization

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions