Re:Creating a tool for Cobol standards



IBM's Command List programming language & Restructured Extended Executor

Re: Re:Creating a tool for Cobol standards

Postby BillyBoyo » Tue May 10, 2016 9:57 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Re:Creating a tool for Cobol standards

Postby Robert Sample » Wed May 11, 2016 6:47 am

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Re:Creating a tool for Cobol standards

Postby BillyBoyo » Wed May 11, 2016 11:27 am

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" :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Re:Creating a tool for Cobol standards

Postby Aki88 » Wed May 11, 2016 11:43 am

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.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Re:Creating a tool for Cobol standards

Postby BillyBoyo » Wed May 11, 2016 10:05 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Previous

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post