We are trying to parse Cobol sources.
Having a ‘CHAINING’ clause in the ‘PROCEDURE DIVISION’ line causes the parser to fail, while the compiler has no problems with it.
Please note that removing the ‘DECLARATIVES’ fixes the parse-error.
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/PP0027 at line 8
Original contents starting from line 1 till line 12:
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0027.
WORKING-STORAGE SECTION.
01 VARIABLE PIC 9.
* The CHAINING clause IN COMBINATION WITH THE DECLARATIVES
* causes the parser to fail:
PROCEDURE DIVISION CHAINING VARIABLE.
DECLARATIVES.
IO-ERROR-INPUT SECTION.
USE AFTER ERROR PROCEDURE ON INPUT.
END DECLARATIVES.
GOBACK.
Preprocessed contents:
Parse error at line 8:
1: IDENTIFICATION DIVISION .
2: PROGRAM-ID . PP0027 .
3: WORKING-STORAGE SECTION .
4: 01 VARIABLE PIC 9 .
7: PROCEDURE DIVISION CHAINING VARIABLE .
8: DECLARATIVES .
^
9: IO-ERROR-INPUT SECTION .
10: USE AFTER ERROR PROCEDURE ON INPUT .
11: END DECLARATIVES .
12: GOBACK .
13: EOF
Please fix this parse-error.