We are trying to parse Cobol sources.
Having a ‘BLANK (WHEN) ZERO’ clause in a SCREEN section causes the parser to fail, while the compiler has no problems with it.
Versions used:
Cobol: AcuCobol version 10.2.1, fixed format
SonarQube: Enterprise Edition Version 9.6.1 (build 59531)
– extract from the parser logging –
ERROR: Unable to parse COBOL source file : /build/builds/_NwxSV3v/0/dataserver-utilities/tdeltaplayground/sonar-parse-errors/cobol-src/source/PP0026 at line 8
Original contents starting from line 1 till line 10:
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0026.
WORKING-STORAGE SECTION.
01 VARIABLE PIC 9.
SCREEN SECTION.
01 DEMO-SCREEN.
* Using the 'BLANK (WHEN) ZERO' clause causes a parsing error:
03 USING VARIABLE COL + 2 BLANK ZERO.
PROCEDURE DIVISION.
GOBACK.
Preprocessed contents:
Parse error at line 8:
1: IDENTIFICATION DIVISION .
2: PROGRAM-ID . PP0026 .
3: WORKING-STORAGE SECTION .
4: 01 VARIABLE PIC 9 .
5: SCREEN SECTION .
6: 01 DEMO-SCREEN .
8: 03 USING VARIABLE COL + 2 BLANK ZERO .
^
9: PROCEDURE DIVISION .
10: GOBACK .
11: EOF
Please fix this parse-error