IBM / zopeneditor-about

IBM Z Open Editor: File issues here!
https://ibm.github.io/zopeneditor-about
Apache License 2.0
47 stars 25 forks source link

COBOL LS - Error processing conditional compilation that wrongly exclude copybook inclusion and trigger false unresolved reference #366

Closed FALLAI-Denis closed 6 months ago

FALLAI-Denis commented 7 months ago

Development environment used

Problem Description

Since the ZOE 3.3.2 update, the management of conditional compilation by the Language Server has greatly improved. Most of the problems have disappeared. I thank you very much for the work accomplished.

However, a new problem has arisen. Probably due to an internal miscalculation of the values of the conditional compilation variables by the Language Server, some copybooks find themselves excluded by conditional compilation conditions, which then causes errors in the Language Server's analysis:

Observed behavior

In the example below, the RTP1 variable used in a program is not resolved. This variable is declared in the AAADGRUP copybook which is conditionally included by the compilation variable AA-A-LECTURES-AVEC-RUPT. The compilation variable AA-A-LECTURES-AVEC-RUPT is declared (by a copybook) with the false value (b'0'), then is switched to the true value (b'1') when calling other copybooks. Apparently the Language Server cannot manage changes in the values of this AA-A-READINGS-WITH-RUPT variable. See in attachment the compilation listing of this program (or a version close to this program).

image

Expected behavior

See compilation listing: S9TL1A_listing.pdf

FALLAI-Denis commented 7 months ago

Hi,

This request has been categorized as "enhancement" but from my point of view it is a "bug" because false problems are reported by ZOE and this impacts the user.

Russell-May commented 7 months ago

I'm glad to hear that our recent bug fixes for conditional compilation have resolved most of the issues you were facing. Thanks for reporting those issues to us. I'll take a look at this one and let you know if I need any additional information.

Russell-May commented 7 months ago

I have been able to identify at least one issue that might be impacting you, but I have been unable to fully replicate what you are describing. Would you be able to provide example files, either the ones you screenshotted from or stripped down versions that display the same issue?

FALLAI-Denis commented 7 months ago

Hi @Russell-May

Thank you for your efforts in resolving these latest issues. Attached, a zip file containing the minimum elements to reproduce the problem described here.

Also included in the zip, the compilation listings of the example program with a version compiled in CONDCOMP(NOSKIPSRC) and a version compiled in CONDCOMP(SKIPSRC).

The program is the result of a skeleton which establishes the general processing kinematics, enriched by the addition of code fragments driven by programming assistant (snippet-style code injection tool we develop). The program uses a set of copybooks which constitute an "intelligent" development framework based on conditional compilation.

ZOE366.zip

Russell-May commented 7 months ago

Hi Denis,

Thanks so much for providing the example files. I was able to reproduce the issue and track it back to an issue with how we are handling >>EVALUATE TRUE statements where the >>WHEN OTHER is hit. I'll notify you once we release an fix for this issue.

@phaumer can you change the label on this to bug, I apparently don't have permission to do so.

FALLAI-Denis commented 7 months ago

Hi,

I replaced the ">>when other" clauses by ">>when codition" in the copybooks: all the false errors reported in the program have disappeared. However, there remain errors in the interpretation of the copybooks themselves.

Perhaps we should deactivate the analysis of conditional compilation in copybooks because in fact it has no meaning at the level of a copybook and only makes sense globally at the level of a program?

image

image

image

image

Russell-May commented 7 months ago

I replaced the ">>when other" clauses by ">>when codition" in the copybooks: all the false errors reported in the program have disappeared. However, there remain errors in the interpretation of the copybooks themselves.

Perhaps we should deactivate the analysis of conditional compilation in copybooks because in fact it has no meaning at the level of a copybook and only makes sense globally at the level of a program?

I'm glad that replacing the ">>when other" clause resulted in a clean parse from the main program for you as well. It makes me confident that the upcoming fix for ">>when other" should get your COBOL parsing cleanly with no modifications.

As for the parsing of the copybooks themselves, this is the currently expected behavior as the copybook does not have the context to parse properly. The suggestion of disabling the analysis of conditional compilation in copybooks I don't believe would have the desired effect as choosing to either include or exclude all of the conditional content would result in invalid COBOL in many cases leaving you with just as many errors as before. We are continuing to consider different solutions for better copybook parsing and appreciate your input on it, but for now, parsing copybooks that require additional context from the COBOL file they are used in can result in unexpected errors.

FALLAI-Denis commented 7 months ago

Hi @Russell-May

Regarding copybooks:

So even if the analysis of copybooks is done taking into account conditional compilation this should not pose a problem on the main programs.

Ok to only deal with the problem related to the ">>when other" directive.

Thanks again for your efforts.

phaumer commented 6 months ago

Fixed for >>when other was deliver with v3.3.3. Please try, @FALLAI-Denis

FALLAI-Denis commented 6 months ago

Hi @phaumer,

Great ! All's right! zero problem in code! This year Christmas fell on December 15! I send a huge thank you to the entire ZOE development team! I wish you a very happy end of year celebration.