View previous topic :: View next topic
|
Author |
Message |
kalyan_lc5
New User
Joined: 06 Jul 2006 Posts: 9
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
define the lines of code concept in general
true lines of code excluding blank and comment lines or ??? |
|
Back to top |
|
|
kalyan_lc5
New User
Joined: 06 Jul 2006 Posts: 9
|
|
|
|
I should have been specific.
yes the lines of code i was asking about is excluding blank and comment lines.
Thanks |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
And how about split lines? |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
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: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 |
|
|
|