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 - Conditional compilation and EXEC SQL INCLUDE SQLCA #379

Closed FALLAI-Denis closed 4 months ago

FALLAI-Denis commented 5 months ago

Development environment used

Problem Description

Almost all of the source code analysis issues related to the use of conditional compilation have been resolved in the latest versions of ZOE, and once again I thank you for your efforts.

However, a new case has just been identified:

Observed behavior

With SQLCA declaration under conditional compilation (even if the condition is true): image

With SQLCA declaration not under conditional compilation: image

This suggests that the COBOL Language Server processes the EXEC SQL statements before having processed the conditional compilation.

Russell-May commented 5 months ago

Can you provide me with a sample program where you are seeing this issue?

FALLAI-Denis commented 5 months ago

Hi,

Sample code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TSTSQLCA.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  HOWMUCH PIC S9(9) COMP-5.
       >>define isDB2 as b'1'
       >>if isDB2
           exec sql include sqlca end-exec.
       >>end-if
       PROCEDURE DIVISION.
       MAIN.
           exec sql
             select count(*) into :HOWMUCH
             from SYSIBM.SYSDUMM1
           end-exec
           if SQLCODE not = 0 and SQLCODE not = +100
             display "Oups !"
           end-if
           .
       BYE.
           goback.

image

image

Russell-May commented 5 months ago

Thanks, I see the issue and will see what can be done to fix it.

phaumer commented 4 months ago

Fixed in v3.4.0.