Total number of lines of codes in production.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
AmjzadAli
Registered Member
Posts: 14
Joined: Sun Oct 26, 2014 7:54 pm

Total number of lines of codes in production.

Post by AmjzadAli »

Hi,

Can we find out that what is the total number of lines of codes in production for our company? This is for mainframes, I am asking for.

I have searched this on google but there are no relevant posts I find. If someone can guide, it'll be a great help.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Total number of lines of codes in production.

Post by Robert Sample »

This is a difficult, most probably impossible, question to answer. Do you mean only the code written at your site or do you include vendor programs that are installed and running in production? If you do want to include vendor code then your answer is that it is not possible to determine the lines of code since vendors do NOT release source code and will not tell you how much code they have.

Another reason this is difficult to know is that mainframes do NOT execute lines of code -- they execute load modules, which are lines of code that have gone through a compile process to create assembler code which is then processed by the linkage editor / binder. And since the compiler generally has different levels of optimization available, there is no more than a vague correlation between the lines of code and the size of the load module.

If you go through and identify all the programs running on your mainframe (a non-trivial task), you could -- THEORETICALLY -- find the source for each program and add up the lines of code. This is complicated by the fact that there is no industry standard method of maintaining source code (some sites use PANVALET, some use LIBRARIAN, some use SCLM, some use PDS libraries or other tools, and some don't use any method or use more than one source code manager). A further complication is that one program could exist is multiple load libraries and there could be a different source with different count of lines of code for each load library. Another complication is that source code gets lost. A program's load module can be executed for many years (for a previous employer, I did a study about 2005 that found the oldest production program had last been linkage edited in 1978) so the source code could have been migrated from DASD to tape and that tape got recycled and hence all the data on it was lost -- or someone didn't realize a PDS had the production source and deleted it to save space. And how do you count copybooks -- once per program they're used in or just once overall?
AmjzadAli
Registered Member
Posts: 14
Joined: Sun Oct 26, 2014 7:54 pm

Re: Total number of lines of codes in production.

Post by AmjzadAli »

Thanks Robert.

We have a baseline library for source code. I need the number of lines of code from this lib. It does not have the source code for the vendor supplied programs. Not having them does not hurt that much. I don't need to be very accurate but an estimate form the lib will help.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Total number of lines of codes in production.

Post by Robert Sample »

You did not clarify how your baseline library is stored -- PDS? PDSE? LIBRARIAN? PANVALET? SCLM? Something else? The precise method to get the lines of code depends upon the type of library (for example, LIBRARIAN has an INDEX command that lists out every module stored in it with the count of lines in that module; for a PDS or PDSE you can use the ISPF line counts for each member for the most part).

Furthermore, "lines of code" is a nebulous concept. The simplest measure (and easiest to find) is the count of lines in each program -- whether data definition, paragraph name (in COBOL), comment, and so forth. Another measure would be lines of code that are not comment lines which would include data definition lines. Another measure would be lines of code in the PROCEDURE DIVISION (for COBOL) -- with comments or without comments which would exclude data definition lines. Whether or not to count paragraph names and section headings would be another question for "lines of code". Another measure would be compiled lines of code (which would include copy book code as well as source statements).
AmjzadAli
Registered Member
Posts: 14
Joined: Sun Oct 26, 2014 7:54 pm

Re: Total number of lines of codes in production.

Post by AmjzadAli »

I think there is a way to find the number of records in a member of a PDS. If you have baseline library where source is available to you, you can run that REXX against it and it can give you the number for each PDS. Summing them would result your answer.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”