Parse-error with 'WAIT FOR THREAD'statement (AcuCobol)

We are trying to parse Cobol sources.

A ‘WAIT FOR THREAD’ 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/PP0028 at line 28

Original contents starting from line 8 till line 41:
       01  THREAD-STATUS                            PIC 99.
           88 THREAD-TERMINATION-OK                 VALUE 00.
           88 THREAD-TERMINATION-NO-SUCH-THREAD     VALUE 10.
           88 THREAD-TERMINATION-TIMED-OUT          VALUE 99.
      *----------------------------------------------------[ procedure ]
       PROCEDURE DIVISION.
       MAIN SECTION.
           PERFORM THREAD SECTION-IN-THREAD HANDLE IN THREAD-HANDLE
           PERFORM WAIT-FOR-THREAD
           GOBACK.
       SECTION-IN-THREAD SECTION.
      *    Some time-consuming code here.
           .
      *------------------------------------[ WAIT-FOR-THREAD ]
       WAIT-FOR-THREAD SECTION.
       BEGIN.
           SET END-OF-THREAD TO FALSE
           PERFORM UNTIL END-OF-THREAD
      *       The concept of 'WAIT FOR THREAD' seems to be not handled
      *       correctly by the parser:
              WAIT FOR THREAD THREAD-HANDLE BEFORE TIME 100
                   STATUS IN THREAD-STATUS
              END-WAIT
              EVALUATE TRUE
              WHEN THREAD-TERMINATION-TIMED-OUT
                 CONTINUE
              WHEN THREAD-TERMINATION-OK
              WHEN THREAD-TERMINATION-NO-SUCH-THREAD
                 SET END-OF-THREAD TO TRUE
              END-EVALUATE
           END-PERFORM
           .
       ENDS.
           EXIT.


Preprocessed contents: 
Parse error at line 28:

   15:  PERFORM THREAD SECTION-IN-THREAD HANDLE IN THREAD-HANDLE
   16:  PERFORM WAIT-FOR-THREAD
   17:  GOBACK .
   18:  SECTION-IN-THREAD SECTION .
   20:  .
   22:  WAIT-FOR-THREAD SECTION .
   23:  BEGIN .
   24:  SET END-OF-THREAD TO FALSE
   25:  PERFORM UNTIL END-OF-THREAD
   28:  WAIT FOR THREAD THREAD-HANDLE BEFORE TIME 100
                                     ^
   29:  STATUS IN THREAD-STATUS
   30:  END-WAIT
   31:  EVALUATE TRUE
   32:  WHEN THREAD-TERMINATION-TIMED-OUT
   33:  CONTINUE
   34:  WHEN THREAD-TERMINATION-OK
   35:  WHEN THREAD-TERMINATION-NO-SUCH-THREAD
   36:  SET END-OF-THREAD TO TRUE
   37:  END-EVALUATE
   38:  END-PERFORM
   39:  .
   40:  ENDS .
   41:  EXIT .
   42:  EOF

Please fix this parse-error.

Hi,

As you announced a few days ago, I see that you indeed opened 18 threads, mainly for parsing errors with AcuCOBOL.
Thanks a lot for sending us all this feedback!

We’re not used to receiving such an amount of feedback about COBOL in such a short period.
For each of the threads you opened, we need to do some investigation. However, we will not be able to do that in the coming days. I’m going to create tickets that we will investigate later. We will dedicate some time in the coming months to fixing as many of them as we can. We’ll try to do that before July.

For this thread, I created SONARCOBOL-1652.

Thank you for your understanding.

Hi,

We had a COBOL sprint recently.
We fixed the problem you reported in this thread as well as most of the other problems you reported in March and April.
That will be included in the next version of SonarQube (10.2).

Thanks again for all your feedback!