Skip to content

Conversation

@Srinidh-GM
Copy link

Problem
When multiple COPY statements exist in the FILE SECTION, the tool was incorrectly expanding the same copybook (the first one encountered) for all subsequent COPY statements. This occurred because the copyTokens list in LineRepository was not being cleared between processing different COPY statements, causing tokens from the first COPY statement to persist and be reused.

Solution
Modified addAccumulatedTokensFromCopyStatementToCopyTokens() method in LineRepository.java to:

  • Detect the start of a new COPY statement by checking if the line begins with "COPY" or "INCLUDE"
  • Clear the copyTokens list when a new COPY/INCLUDE statement is encountered
  • Use case-insensitive comparison to handle both uppercase and lowercase statements

Testing
Added a new copybook FSTEST.cpy and a COPY FSTEST statement to the file section of filecopy.cbl to test this change

Srinidh-GM and others added 4 commits November 26, 2025 15:59
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