openmainframeproject / cobol-check

A testing framework for Cobol applications
Apache License 2.0
78 stars 28 forks source link

Fix db2 #330

Open samdion1994 opened 10 months ago

samdion1994 commented 10 months ago

Fix the expands db2 copybooks.

Rune-Christensen commented 10 months ago

Hi @samdion1994

Thank you for the tests, it helped tremendously in understanding what is happening.

With that understanding now in place, I cannot approve the pull request, because the expansion of the copybook is no longer happening "in place". Meaning, we cannot move the working storage elements, to other locations in working storage. Consider this example:

EXEC SQL INCLUDE TEXEM  END-EXEC.
01  TEXEM2 REDEFINES TEXEM.
   10 FULL-NAME PIC X(20).
   10 FILLER PIC X(26).

The current changes would move TEXEM below the redefine, meaning the compile would fail.

Looking at the code again, I think the insertion of code is in the correct location, the issue is, that .getFileSectionStatements() is a bad name. Either the function is misused in this context, and there ought to be another function managing the expansion of copybooks, or the function should have another name, making it useable in more contexts.

Cheers, Rune

Rune-Christensen commented 10 months ago

Hi @samdion1994 Thank you, the new function is a much better encapsulation of what is happening in the code.

But, the changes still moves the expanded copybook to a new location, that will have to be fixed before approval. Thank you

Cheers

Rune-Christensen commented 9 months ago

Hi @samdion1994 Any progress on reverting the changes, that causes the expansion of SQLCA/TEXEM to move from where it was?

Regards Rune

samdion1994 commented 9 months ago

Hi rune, Sorry been busy!

Probably this week :)

samdion1994 commented 9 months ago

Hey @Rune-Christensen,

Think you can merge this and I could do another fix later?

There a lot of stuff I need to change for this request and little time, but I get what you're saying and I agree that this needs to be fixed. Also I think we might have the same problem with the file section expander.