LOC (Lines of code)

When I am asked to determine how many lines of code that I have for a giving application, I don’t have any utility that would help me.
Under NATURAL 3.1.6, when I type LIST * and press PF11, I can see how many lines each module has, but that is only good for that screen.

If I have 1000 modules, I have to keep pressing PF8 and PF11 and keep adding the numbers. If I try in batch, it does not work… :frowning:

Another approach is to use SYSTRANS UNLOAD and take a look on the number in the report, than I multiply by .75 and get an estimated number.

Any unknown utility available or option of the LIST command ?

Thanks

Carlos,
If you have Natural Engineer this will give the number of lines information in the “Source Code summary” report.
Regards
Jon

Thanks John.

I am aware of Natural Engineer, but we don’t have it and it does not look like we will have it soon.

I was hoping that Darmstad would have a solution similar to the PF11 on the LIST command.

Regards,

Carlos

For applications compiled with the Optimizer Compiler NOCSTAT may be an option, gives you statement counts for all NOCed objects, with the advantage of providing downloadable CSV or XML output.

NOCSTAT will provide the total number of statements in an object, as well as the number that are noc-able, and also breakdowns by statement type. THe CSV output makes it quite easy to manipulate for totals in Excel. Natural Opt. does not have to be installed to use NOCSTAT. Also it reports statements not lines of code.

Right, I mis-formulated…

Should have been “for every compiled object”, of course.

“Statements”, in that context, does not include DEFINE DATAs, btw.

Unfortunately, NOCSTAT does not fit the bill for what we need :frowning:

Hmmm

I’m curious does NOCSTAT report significantly different numbers than LIST * :?

Sure, a lot! Just try it and you will see.

NOCSTAT, as I mentioned, totally excludes the DEFINE DATA section.

I’d suggest using USR1032N to read the library directory, then read the objects via USR1057N and count the “lines of code”.

I found it easier to do a NATUNLD of the source and write a program to read the flat file to count the lines of code.

As I said on my first posting, we use SYSTRANS UNLOAD and than multiply the numbers from the output by .75 to get an estimate.

My company has over 650 applications and 80 of them are critical and written in ADABAS/NATURAL. We really need something simple and objective like LIST LOC * or ALL or similar.

Unless you want to submit a CE, then parsing either the NATUNLD or the FUSER file is the only way that I know of to get the information. By Reading the NATUNLD we create a report that can tell us by library, by object type how many lines of code that we have, we also have the option not to count comment lines. I don’t work for a large shop, but not counting comments, we do have over 30 million lines of code in our shop.

If you would like more information on how we do this, let me know, otherwise, I think the CE is your only option.

Sure, that would be good if you can send the info.
30 millions ? Huuummm, we have to talk :lol:

If you send me your email address, I will send you a systrans of the code, I tried to attach it here, but there is a 5k limit and the systrans file is 15k. the program is only about 160 line or less, not large by any means. I can be reach at slboehm@uss.com

Maybe ZIPping it would reduce the size to less than 5k ?

Ok, I think zipping it may work, I used winzip to compress the file
slbcnt.zip (2.1 KB)

Ok, I think zipping it may work, I used winzip to compress the file
slbcnt.zip (2.1 KB)

Carlos,

It sounds like you already have the LISTPROF modified in your SYSLIB or you wouldn’t be getting the LINES counted column. You normally only see the SIZE column (which is the number of bytes). If not, copy LISTPR-S from SYSLIB and modify it to make a SYSPROF in SYSLIB. Be careful of the square brackets, they need to be hex 41 for left, and hex 42 for right.

So, modify the LISTPROF a little more and have it keep the SORT dataset in a library where you can play with it. (Preferrably, do this by user-id, do not make it the default for everyone).

Then from the Natural command line, do a L P * command, and at the bottom of the first screen type the SORT subcommand. It will generate a Natural member that contains all the info you need.

From there, you have a dozen ways to read the data and add the numbers. For example, batch LIST the member to a file, and have a Natural program READ WORK, add the column for lines and WRITE the totals as you like. Or, once it is listed to a file, DFSORT or SYNCSORT have commands that read files and add columns for you. You don’t even need to write a Natural program if you don’t want. All very simple stuff… only a few minutes of effort to build.

Hope that helps.

Huuum, I just got your reply Darrel. I will take a look on Monday.
Are you still at same number at WSU ?