Hi,
We are using SonarQube Cloud to analyse a Micro Focus COBOL codebase and are seeing parser errors on valid Micro Focus COBOL syntax.
Product
SonarQube Cloud
CI: Azure DevOps
Language
COBOL - Micro Focus COBOL
Our relevant analyzer configuration is:
sonar.cobol.dialect=microfocus-cobol
sonar.cobol.sourceFormat=free
sonar.cobol.file.suffixes=cbl,pco
sonar.cobol.copy.suffixes=cpy
The scanner confirms that this configuration is being used:
About to analyse COBOL Programs using ‘microfocus-cobol’ dialect and ‘free’ source code format.
Both .cbl and .pco files are correctly indexed as COBOL.
Rule
N/A - this is a parser error rather than an issue raised by a rule.
Problem
The analyzer fails to parse OPEN statements using WITH LOCK.
For example:
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST-WITH-LOCK.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT TEST-FILE
ASSIGN TO "test.dat"
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD TEST-FILE.
01 TEST-RECORD PIC X(10).
PROCEDURE DIVISION.
OPEN OUTPUT TEST-FILE WITH LOCK
CLOSE TEST-FILE
STOP RUN.
The error is reported at:
OPEN OUTPUT TEST-FILE WITH LOCK ^
In our production code we see the same parser error in both .cbl and .pco files, across many different OPEN statements.
The syntax is accepted by our Micro Focus COBOL compiler.
Expected behaviour
When the microfocus-cobol dialect is selected, OPEN ... WITH LOCK should be parsed successfully.
Actual behaviour
SonarQube Cloud reports a COBOL parse error at WITH LOCK.
Could you confirm whether OPEN ... WITH LOCK is currently supported by the Micro Focus COBOL parser?
If this is an analyzer/parser issue, could it be investigated?
We can provide additional scanner logs or a more complete minimal reproducer if required.