Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting lines of code 1

Status
Not open for further replies.

jckrell2

Programmer
Nov 4, 2003
13
US
Hello,

I have an application that I need to provide a count for the total number of lines of cobol code. Does anybody know the best way to do this? Does anybody know of any utility that can do this or a maybe a freeware or shareware program that could be downloaded? Any help will be appreciated.

Thanks.
 
Hello,

Unfortunantly not trying to impress the boss. I have to do this.

Anyway, the link you gave does not seem to work. It is over 3 years old and I don't believe it's there anymore.
 
Oops! Sorry about that.

Plan B.

What do you consider a line of COBOL code?

For example, how many lines are you willing to attribute to a MOVE statement that spans multiple line?

What about an IF...END-IF block? Is it considered 1 line?

Depending on your answer, I may be able to provide you with the correct (not broken;) resource.

Dimandja
 
Apparently Shakespear wasn't a programmer. While "a rose is a reose...", a line of code can be many things.

It would help if you could tell us how the count will be used. It's important to know things like: procedure div only? copybooks code count (once or each use), comment lines, etc.

Don't phoo phoo any of these ques. Depending on the use to which the count is put, the answers can vary.

Regards, Jack.
 
OOPS, wanted to check the spelling of the Bard before I posted. It s/b "Shakespeare".
 
ok, actually this doesn't have to be exact. Comments should not count in the linecount but hey, there aren't many of those anyway. One statement on multiple lines should count as one statement. Copy books should count and I would be satisfied to have a count for the total number of lines in the program, not just the procedure division. As I said, it doesn't have to be exact.

Ok, anybody got anything?
 
You may start by looking into your compiler directives. A compiler I've used before will count all instances of verbs used (which should take care of IF, MOVE, PERFORM, counting each occurence as 1 line).

You can also put together a small routine that will match the source code against a list of COBOL reserved words. Nifty, hunh?

There are also many other tools (especially from the Y2K wars) that will do all this for you for a "small" fee. Look into code editing tools, etc...

Dimandja
 
The following is what we use to size a mainframe application that will be ported to a Windows platform, The utility runs on Windows/2000 or XP. Therefore, the source code would need to reside on the PC or a server. It creates a lot more detail than the following summary information. If this is sufficient for your purposes let me know and I can send you a copy of the utility via zip file and e-mail. For more information refer to the following URL...


Summary Report
--------------
* Language(Type)........ Members Lines of Code
* COBOL(CBL)............ 67 33566
* COBOL(CPY)............ 50 10710
* JCL(JCL).............. 98 4981
* JCL Procedures(PRC)... 0 0
* JCL Includes (INC).... 2 84
* 370 Assembler(MLC)..,. 0 0
* 370 Assembler(CPY).... 0 0
* 370 Assembler(MAC).... 0 0
* BMS Members........... 0 0
* MFS Members........... 0 0
* DBD Members........... 0 0
* PSB Members........... 0 0
* Unknown............... 0 0
* ??? Members........... 0 0

*- Subtotal (Known)..... 217 49341
*- Subtotal (UNKnown)... 0 0
*- TOTAL................ 217 49341



Saginaw
helpdesk@simotime.com
 
Hi jckrell2,

If you ar using RM/Cobol, there's a sample program called analysis.cbl provided.
 
jckrell2,

It would be helpful to know what compiler you are using.

Perhaps something as simple as post-pocessing a listing file would serve, since there are often statistics placed in the listing. Such an approach would be specific to the compiler, though.

Tom Morrison
 
Actually the cobol is micro focus cobol on a pc.
Thanks for all the input. I was able to use the program
that saginaw sent me and it worked perfectly. I was able to
get linecounts from several hundred programs. Thanks again
Saginaw you saved my day.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top