ECN-4348 Compiler can detect when verbs are terminated implicitly

Type of Change: Enhancement

Incidents: 2817156

RPI Number: 1099132

Product: ACUCOBOL-GT

Module: Compiler

New Version: 10.0

Machines Affected: All

Known Versions Affected: All

Description of enhancement

Using ANSI-85 constructs can make COBOL programs much more readable. Unfortunately, there has not been an easy way to detect when such constructs are missing.

For example, consider the following code:


    IF a = b
        display message box "a = b"
    ELSE
        display message box "a NOT= b"
    | an END-IF is here missing

    display message box "Run is completed"

Based on the indentation, this has a different meaning than is intended.

Instructions for use

The compiler can now report when an END construct is missing. In order to get this information, you must use the -Wu compile option (check unterminated verbs). The message reported will be:

my-test.cbl, line 40: Warning: Implicitly terminated verb: IF found with no END-IF.

The verbs that are checked for a missing end construct are ACCEPT, ADD, CALL, COMPUTE, DELETE, DISPLAY, DIVIDE, EVALUATE, IF, MODIFY, MOVE, MULTIPLY, PERFORM, READ, RECEIVE, RETURN, REWRITE, SEARCH, START, STRING, SUBTRACT, UNSTRING, USE, WAIT, WRITE, and XML GENERATE and PARSE.

Note that only complex cases are reported. It would be unhelpful to see a warning for every simple move, such as MOVE A TO B, for example.