Skip to content

Conversation

@Srinidh-GM
Copy link

Summary
This change improves COBOL source line handling in cobol-check to enhance compatibility with GnuCOBOL and address issues with right-hand sequence numbers.

Details
Pagination Directives Filtering:
Lines containing the pagination directives EJECT or SKIP (and variants) are now automatically commented out during source processing. This prevents GnuCOBOL from failing on these unsupported statements.

Right-Side Sequence Number Removal:
All COBOL source lines now have any right-hand sequence numbers (columns 73–80) removed. This fixes issues where such numbers would cause parsing or execution errors.

Non-Disruptive:
The filtering is implemented in a way that does not affect other line processing or introduce regressions. All existing tests pass, and new tests have been added to verify the new behavior.

Tests:
Unit and integration tests were added for:

  • Detection and filtering of EJECT/SKIP lines
  • Removal of right-side sequence numbers
  • End-to-end verification in the line reader

Files Changed
Modified:
Constants.java - Added COBOL column constants (COBOL_LINE_NUMBER_COLUMN_END, COBOL_CODE_AREA_END)
StringHelper.java - Added shouldFilterLine() and removeRightSideSequenceNumbers() methods
CobolReader.java - Integrated line filtering in readLine() and peekNextMeaningfulLine() methods
StringHelperTest.java - Added unit tests for new filtering methods

Added:
CobolReaderLineFilteringTest.java - Integration tests for end-to-end line filtering functionality
TEST-FILTER.cbl and TEST-FILTER\Testcobollinefilter.cut - Cobol program and test cases to test this change

@Srinidh-GM Srinidh-GM force-pushed the Fix-Cobol-Line-Filtering branch from 238e8ff to 761bb17 Compare December 2, 2025 09:34
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.

1 participant