We are trying to parse Cobol sources.
Some ‘format-3’ moves with multiple lines of code in an ‘ON EXCEPTION’ block cause parse-errors.
I have included an example that does not parse.
In this case it is not easy for us to determinewhat exactly causes the parse-error to occur.
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/PP0025 at line 17 Original contents starting from line 1 till line 17: IDENTIFICATION DIVISION. PROGRAM-ID. PP0025. WORKING-STORAGE SECTION. 01 VARIABLE PIC 9. PROCEDURE DIVISION. * The code between the 'ON EXCEPTION' and the 'END-MOVE' * causes a parsing error. Not quite sure what exactly triggers * it: Removing the 'MOVE 3 TO VARIABLE' already fixes it, as * does replacing the 'IF' statement by a simple MOVE statement. MOVE "1" TO VARIABLE WITH CONVERSION ON EXCEPTION MOVE 3 TO VARIABLE IF VARIABLE = 0 MOVE 4 TO VARIABLE END-IF END-MOVE GOBACK. Preprocessed contents: Parse error at line 17: 4: 01 VARIABLE PIC 9 . 5: PROCEDURE DIVISION . 10: MOVE "1" TO VARIABLE WITH CONVERSION 11: ON EXCEPTION 12: MOVE 3 TO VARIABLE 13: IF VARIABLE = 0 14: MOVE 4 TO VARIABLE 15: END-IF 16: END-MOVE 17: GOBACK . ^ 18: EOF
Please fix this parse-error