Page 2 of 2

Re: Re:Creating a tool for Cobol standards

PostPosted: Tue May 10, 2016 9:57 pm
by BillyBoyo
OK, so it's not that much less simple. You have the line-numbers of the paragraphs from the cross-reference. You look between first and last of a paragraph (line before the next) and count per paragraph. Report every time you encounter a full-stop/period after you have counted to two.

Re: Re:Creating a tool for Cobol standards

PostPosted: Wed May 11, 2016 6:47 am
by Robert Sample
Have you considered things like:
IF  GROSS-SALES < QUOTA-SALES
    MOVE .08 TO SALES-COMMISSION
ELSE
    MOVE .12 TO SALES-COMMISSION
END-IF.
or
MOVE "841.05" TO DEWEY-DECIMAL-CODE

There are cases where periods are legitimately in the code and NOT at the end of a paragraph.

Re: Re:Creating a tool for Cobol standards

PostPosted: Wed May 11, 2016 11:27 am
by BillyBoyo
For a separator full-stop/period it should be followed by a space. Column 72 full-stops seem initially tricky, but a blank in column 73 deals with that.

When "looking at" COBOL programs I always rely on the compiler doing most of the real work, and that includes issuing diagnostics (so the output is assumed to be clean of relevant diagnostics, so no need to code for those situations).

However, I guess something I didn't think about is that 123. is a valid numeric literal. Even if that gets reported, it is probably a good idea to get it "fixed" :-)

Re: Re:Creating a tool for Cobol standards

PostPosted: Wed May 11, 2016 11:43 am
by Aki88
BillyBoyo wrote:For a separator full-stop/period it should be followed by a space.

If the TS has in-line comments (depending upon their COBOL release), it'd mean additional code. Just my two pennies worth suggestion.

Re: Re:Creating a tool for Cobol standards

PostPosted: Wed May 11, 2016 10:05 pm
by BillyBoyo
Good point Aki88 :-)

In-line comments would never fit in my code, but if they are or may be present (Enterprise COBOL V5.something onwards) then for the task you should obliterate them from the start ("*>") to the end of the line.

Let's assume there are no SQL statements, and no COPY/REPLACE in the PROCEDURE DIVISION whilst we are at it as well.