Mainframe
Documentation

Version Latest

Checks and code review

COBOL problems as you type against Enterprise COBOL's rules, unreachable code in Problems, and code review with the shop's rule set, quick fixes and an agent tool.

Verification state: the checks and the code review are the module's own code, verified on Linux on AWS CardDemo's 44 programs and copybooks, the payroll sample and planted problems. They are not compared with Enterprise COBOL's own messages, and the Language Reference section titles they cite have not been rechecked against IBM's manual. For Enterprise COBOL's verdict, use Check on z/OS; for GnuCOBOL's, the workstation check.

COBOL problems as you type

As Z Open Editor's language server reports them, before you save. neuralInverse.mainframe.cobol.liveCheck (on by default) turns it off.

The check covers:

  • the reference format: Areas A and B, the indicator, continuation;
  • division and section structure, separator periods;
  • level numbers and PICTURE validity;
  • scope terminators and the required phrases of the common statements;
  • undefined, ambiguous and wrongly qualified names.

Each problem names its rule and the Enterprise COBOL Language Reference section. The check runs 300 ms after typing stops. Name rules wait while a copybook is missing (except CICS DFH* and Db2 SQLCA and SQLDA), under REPLACE or >>IF, or with several programs in a file. GnuCOBOL's message for the same problem is not shown twice.

No false positives on CardDemo's 44 programs and copybooks. Measured: a 4,237-line program with copybooks at a median of 64 ms of CPU time per check.

Unreachable code

Unreachable sections and paragraphs appear in Problems as warnings, faded in the editor, with the reason: nothing names it, only unreachable code performs it, the paragraph before ends with GO TO or GOBACK, or it follows the end of a PERFORM range. Statements after GO TO, GOBACK, STOP RUN, EXIT PROGRAM, CICS RETURN or XCTL are marked the same way.

The quick fix Show in Program Control Flow opens the paragraph in the control flow. neuralInverse.mainframe.cobol.unreachableCode (on by default) turns it off. It finds the same unreachable procedures as the control flow editor on all of CardDemo.

Code review with the shop's rule set

As IDz Code Review and ZCodeScan do it, with the module's own rules and texts.

Rule areaExamples
Control flowGO TO outside the section, ALTER, PERFORM THRU across sections, STOP RUN in a subprogram
StructureIF nesting depth, paragraph length, EVALUATE without WHEN OTHER
DataUnused data items and paragraphs, COMP-3 with an even digit count, numeric MOVE truncation, literals in the PROCEDURE DIVISION
Error handlingI/O without a FILE STATUS check, SQL without an SQLCODE check, CICS without RESP
  1. Set severities and limits in codeReview of mainframe.json, or point it at a shared rule file.
  2. The review runs on save, or for the whole application with Run Code Review.
  3. Findings appear in Problems with the rule ID. Three rules have safe quick fixes.

Agents run the same review through a tool. Verified on all 44 CardDemo programs (findings checked by hand per rule; all 26 quick fixes applied with nothing new appearing). The defaults have not been tuned against a shop's actual rule set.

Last reviewed 18 October 2026View as Markdown

Checks and code review · Docs · Neural Inverse