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…
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 ?
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.
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.
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
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.