Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

counting the number of lines of code

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
View previous topic :: :: View next topic  
Author Message
kalyan_lc5

New User


Joined: 06 Jul 2006
Posts: 9

PostPosted: Thu Aug 25, 2011 11:25 am    Post subject: counting the number of lines of code
Reply with quote

Hello,

Please let me know if there is any way to find out the number of lines of code in natural program or in subprogram.

Thanks in advance,
Kalyan
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Thu Aug 25, 2011 11:30 am    Post subject: Reply to: counting the number of lines of code
Reply with quote

define the lines of code concept in general
true lines of code excluding blank and comment lines or ???
Back to top
View user's profile Send private message
kalyan_lc5

New User


Joined: 06 Jul 2006
Posts: 9

PostPosted: Thu Aug 25, 2011 11:37 am    Post subject:
Reply with quote

I should have been specific.
yes the lines of code i was asking about is excluding blank and comment lines.

Thanks
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 25, 2011 11:38 am    Post subject:
Reply with quote

And how about split lines?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 25, 2011 11:42 am    Post subject:
Reply with quote

Basic check - in a program remove all the blank lines and commented lines and then count the number of line.

You can either do it manually or write a rexx for this.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Thu Aug 25, 2011 12:19 pm    Post subject: Reply to: counting the number of lines of code
Reply with quote

I have to ask...

Why do you want to count the lines of code?

If development environment/interpreter/compiler (whatever, I don't know) doesn't tell you (check the manuals) then a reliable way is just to count the lines yourself.

As has already been pointed out, the reason this is "reliable" is that you know what you want to count as "a line of code". Blanks, comments, you don't want. Split lines (continuations) you probably want as one. Data definitions? Report definitions? Screen definitions? Actual code to do manipulation of the previous?

If you really want to go nuts and can get the stuff to a dataset which you can read externally, you could write a "quick" program to do it. It might take longer than you think. Back to the first question.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Aug 25, 2011 9:58 pm    Post subject:
Reply with quote

If you have access to the FUSER, the field LK contains the source code. This is an MU, so you can use its counter (note the descriptor for the program name).

Another option is to alter user exit 1057. This user exit reads the current Natural source area into an array.

O.
Back to top
View user's profile Send private message
Ralph Zbrog

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Fri Aug 26, 2011 11:11 am    Post subject: Reply to: counting the number of lines of code
Reply with quote

Kalyan,

For my needs, I have found the counts provided by the LIST command to be accurate enough, but I don't usually limit my analysis to programs and subprograms. Comment lines don't skew the results so badly that I would write a program to parse Natural code - that would be a waste of my time and a waste of my boss/client's budget!

First, enter a list command. For example, to report all module types, or all subprograms, or all programs:
    L *
    L N *
    L P *
Then press PF11 to scroll right to see the counts. If they are not displayed, enter the COUNTSOURCE ON subcommand to override the default setting.

====================================

The NOCSTAT command will provide the number of Natural statements in a programming object (not data areas, texts, recordings, etc). I've applied it to one or a handful of modules, but you shouldn't have any trouble analyzing an entire application. The results can be output as a CSV or XML file for further processing. This utility is intended to demonstrate the effectiveness of the Natural Optimizer Compiler, but it will also serve your purpose.

====================================

For a complete set of metrics for your application, take a look at Natural Engineer (separately-priced product). It has some great features.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us