IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

counting the number of lines of code


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Aug 25, 2011 11:30 am
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 25, 2011 11:38 am
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 25, 2011 12:19 pm
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: 2358
Location: Israel

PostPosted: Thu Aug 25, 2011 9:58 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top