We are trying to parse Cobol sources.
Having a ‘NO’ clause by itself in an accept statement 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/PP0031 at line 7
Original contents starting from line 1 till line 8:
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0031.
WORKING-STORAGE SECTION.
01 VARIABLE-1 PIC X(02).
PROCEDURE DIVISION.
* The 'NO' clause by itself causes a parsing error:
ACCEPT VARIABLE-1 NO POS 10
GOBACK.
Preprocessed contents:
Parse error at line 7:
1: IDENTIFICATION DIVISION .
2: PROGRAM-ID . PP0031 .
3: WORKING-STORAGE SECTION .
4: 01 VARIABLE-1 PIC X ( 02 ) .
5: PROCEDURE DIVISION .
7: ACCEPT VARIABLE-1 NO POS 10
^
8: GOBACK .
9: EOF
Please fix this parse-error