Skip to content

#3942 / #3943: VALUES [ARE] is a VALUE clause; a copybook keeps a decimal-comma literal as written - #3948

Merged
squid-protocol merged 2 commits into
mainfrom
fix/3942-3943-values
Sep 28, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/3942-3943-values

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #3942
Fixes #3943

Leftovers from #3911 (#3940). Both are in the COBOL record VALUE capture (mainframe_boundary._cobol_records).

#3943: VALUES [ARE] is a VALUE clause

_VALUE_CLAUSE matched only the singular VALUE. Condition-names written with the plural (88 OK VALUES 1, 2, 3., 88 WS-PASS VALUES ARE 041 THRU 100.), and single items written VALUES "CABANA", recorded no value at all. The capture now accepts VALUES? with IS / ARE, and records the first literal, as the singular form does.

The keyword boundary is now a COBOL-name boundary ((?<![A-Z<national>0-9-])) instead of \b. That fixes a second, older bug. \bVALUE matched inside hyphenated names, and the last data item's text window runs on into the PROCEDURE DIVISION. So MOVE LOW-VALUE TO … gave CBSA's last COMMAREA items the value TO (9 programs), and cobol-check's paragraph 100-COMPUTE-VALUE SECTION gave TEXT-3 the value SECTION. HIGH-VALUES as a value is unaffected (tested).

#3942: a copybook keeps a decimal-comma literal as written

A copybook has no SPECIAL-NAMES: DECIMAL-POINT IS COMMA belongs to the program that COPYs it, so the per-file scan can't know it. But a separator comma is always a comma followed by a space, so 12345,67 in a copybook can only be one literal. It is now kept as written when the stream is a copybook, meaning it has neither a DATA nor a PROCEDURE DIVISION header. That is correct in every program that includes it, and the reader applies that program's decimal point (#3911's contract).

A program that doesn't declare DECIMAL-POINT IS COMMA is unchanged: it still stops at the comma. This is simpler than the issue's per-compilation-unit suggestion. It needs no cross-file resolution and can't conflict when programs with different settings share a copybook.

Golden masters (re-blessed, 22 differences per mode)

I diffed every COBOL file in the crucible corpus between main and this branch. There are 52 record changes, all intended:

  • 42 items gain their value from a VALUES clause: CardDemo's FLG-*-ISVALID 88s (Y), WS-NO-INFO-MESSAGE VALUES SPACES LOW-VALUES (SPACES), WS-PASS VALUES ARE 041 THRU 100 (041), WS-CIUDAD PIC X(20) VALUES "CABANA", and so on.
  • 10 bogus values removed: TO on 9 CBSA COMMAREA items and SECTION on one cobol-check item.

Tests

tests/cobol_mainframe/test_values_and_copybook_comma.py:

  • VALUES, VALUES ARE … THRU, VALUE IS;
  • HIGH-VALUES / HIGH-VALUE as values;
  • a copybook's 12345,67 next to a VALUES 1, 2, 3 list;
  • a program without the clause, unchanged;
  • a decimal-comma program's VALUES 1,5 2,5.

Gates

pr_gates.py: lint, audits, secrets, xray, gauntlet and suite PASS. Golden failed only on the intended drift above, then passed after the re-bless.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits September 27, 2026 20:09
…imal-comma literal as written

#3943: the record VALUE capture now accepts the plural VALUES and IS / ARE, with a COBOL-name
boundary (not \b) so HIGH-VALUES is never read as the keyword. 88-level VALUES lists record their
first literal, as VALUE does.
#3942: a copybook (no DATA / PROCEDURE DIVISION header) has no SPECIAL-NAMES; DECIMAL-POINT IS COMMA
belongs to the COPYing program. A separator comma is comma + space, so 12345,67 there is one
literal: kept as written, right in every program that includes it. Programs without the clause are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ues; bogus TO / SECTION values gone

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 e6d7a80 into main Sep 28, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/3942-3943-values branch September 28, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant