user3782149
user3782149

Reputation: 33

COBOL plugin reports parse errors

Our team is running SonarQube instances for a variety of languages (java,pl/sql,C,C++).

Recently we were asked to run code quality analysis on COBOL code.

We have received some COBOL code from the development team and ran a Jenkins job.

During the analysis however we see some parsing errors.

Next to that no issues are found according to the analysis.

That is the very first time that we do not encounter any issues in an analysis so we are somewhat suspicious and wonder if the COBOL code is actually parsed in the correct way.

FYI we do not have any COBOL background ourselves.

I have pasted below some of the errors shown during the analysis.

In the end the analysis reports: 09:01:51.131 INFO - 2/2 files analyzed, but since we are not COBOL experts we wonder if the code is actually analyzed corretly?

Details:

Questions we raised towards the development team:

Parse errors *Preprocessed contents:

Parse error at line 279:
  279:  01 MISCELLANEOUS-LITERALS .
       ^
  283:  05 L-ERROR-SIZE-ERROR PIC S9 ( 4 ) COMP VALUE 1 .
  284:  05 L-ERROR-CONTRACT-ORDER PIC S9 ( 4 ) COMP VALUE 2 .
  285:  05 L-ERROR-ORDER-SUBS-TRAFFIC PIC S9 (*

*Preprocessed contents:

Parse error at line 55:
   55:  01 LITERALS .
       ^
   56:  02 L-NO-CONTEXT-FOUND PIC 9 ( 4 ) COMP VALUE 5 .
   57:  02 L-ERROR-REQUEST-CODE PIC 9 ( 4 ) COMP VALUE 14 .
   58:  02 L-ERROR-READ-FIRST PIC 9 (
09:01:51.124 ERROR - Unable to parse COBOL source file : /home/ecbbuild/cobol/dvs010.tdsrcdgs.gsu2001l at line 279
Original contents starting from line 259 till line 299:
*                       48 : dependent end-pay
*
*                       When items is produced by ENDPAY request,
*                       50 is added to the values above
*
*    Encoding of internal-sort, when usage-plan discounts:
*
*       99PPPPPPPPQQQQQQFF
*       PPPPPPPP        Usage-plan-product-nr from line-total-adjust
*       QQQQQQ          First-start-date converted to georgian date,
*       FF              Usage-plan-display-aggregate-flag N=1, Y=2, D=3
*
*    Encoding of internal-sort, when information-item-type:
*
*       00PPPPPPPPYYYYMMDD
*       PPPPPPPP        product-reference-code OF inv-item-table
*       YYYYMMDD        item-from-date         OF inv-item-table
*

?SECTION gsu2001-error-literals
   01 miscellaneous-literals.
*
*     Reply-codes:
*
     05 l-error-size-error             pic S9(4) comp value  1.
     05 l-error-contract-order         pic S9(4) comp value  2.
     05 l-error-order-subs-traffic     pic S9(4) comp value  3.
     05 l-error-date-interval          pic S9(4) comp value  4.
     05 l-error-inv-item               pic S9(4) comp value  5.
     05 l-error-update-sold-product    pic S9(4) comp value  6.
     05 l-error-inv-item-text          pic S9(4) comp value  7.
     05 l-error-delete-sold-item-text  pic S9(4) comp value  9.
     05 l-error-sold-item-text         pic S9(4) comp value 14.
*-FAD-MOD-15.04.2005-#446902--------------------------------------------------*
*     05 l-error-line-total             pic S9(4) comp value 15.
*     05 l-error-line-total-adjust      pic S9(4) comp value 17.
     05 l-error-contract               pic S9(4) comp value 30.
     05 l-original-invoice-not-found   pic s9(4) comp value 38.
*     05 l-dup-error                    pic s9(4) comp value 39.
*     05 l-error-reading-cost-detail    pic s9(4) comp value 40.
***FIX IT - START*

Upvotes: 0

Views: 729

Answers (1)

piet.t
piet.t

Reputation: 11921

Just a wild guess from my part: make sure you process the code as it is provided including leading whitespace. COBOL is not free-format (at leat not before COBOL 2002), so positions matter a lot - an asterisk marking a comment must be at column 7 etc.

Upvotes: 1

Related Questions