Joined: 17 Dec 2002 Posts: 17 Topics: 2 Location: NJ, USA
Posted: Mon Feb 24, 2020 3:59 pm Post subject:
For shops that use IBM File Manager instead of Fileaid, you can use File Manager to generate a list of members in a PDS with a count of the number of records in each member.
Member Copy Report
Member Newname Alias Status Recs in
------------------------------------------------------------------------------
AAAA Copied 1093
BBBB Copied 715
CCCC Copied 259
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Feb 24, 2020 4:07 pm Post subject: Re: How to get Line of code for each application
Magesh_J wrote:
Hi,
I am trying to fetch LOC(lines of code) for each application.
I have programs in PDS, the goal is to identify LOC.
Magesh_J,
IMHO, the counting lines of code is a futile exercise. You don't exclude the comments in the program and if you count the comments as lines of code, then it is misleading. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Mon Feb 24, 2020 4:51 pm Post subject:
And how about blank lines or lines with multiple statements or statements crossing multiple lines? _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Feb 24, 2020 5:41 pm Post subject:
Spolacek wrote:
For shops that use IBM File Manager instead of Fileaid, you can use File Manager to generate a list of members in a PDS with a count of the number of records in each member.
Spolacek,
Just so you know you can use the SETC command to get the accumulated totals at the end.
IMHO, the counting lines of code is a futile exercise. You don't exclude the comments in the program and if you count the comments as lines of code, then it is misleading
Nic Clouston wrote:
And how about blank lines or lines with multiple statements or statements crossing multiple lines?
they asked me for the lines of code, i gave them.
if we need to consider the comment and blanks and two lines then we need to refer compile listing where we should refer VERB-1
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon Feb 24, 2020 11:47 pm Post subject:
Magesh_J wrote:
they asked me for the lines of code, i gave them.
Magesh_J,
Just so you know, you can use the SAVE command in ISPF to save the member names and stats to a file.
Open the PDS and at command prompt issue the command
Code:
SAVE any8-character-name
For ex:
Code:
SAVE LOC
this will save the member listing as Yourid.LOC.members If you are not sure about the naming conventions press PF1 and it will show you the name of the file where the listing is saved.
The Size aka loc column starts in position 55 on wards. You can use this to file to add up the totals
Magesh_J wrote:
if we need to consider the comment and blanks and two lines then we need to refer compile listing where we should refer VERB-1
I am guessing that VERB-1 is file-aid keyword? Not sure how it distinguishes between different language compilers (Assembler, COBOL, C++, PLI, REXX..)
Magesh_J wrote:
is file layout is considered as a loc ?
Yes, if the file layout is used in the program. Compilers often have options to OPTIMIZE code where it looks for unused variables and removes them from compiler listing. _________________ Kolusu
www.linkedin.com/in/kolusu
Just so you know, you can use the SAVE command in ISPF to save the member names and stats to a file.
Open the PDS and at command prompt issue the command
Code:
SAVE any8-character-name
For ex:
Code:
SAVE LOC
this will save the member listing as Yourid.LOC.members If you are not sure about the naming conventions press PF1 and it will show you the name of the file where the listing is saved.
The Size aka loc column starts in position 55 on wards. You can use this to file to add up the totals
thanks for the information, really useful, but for some of the members in the pds the stats are not available.
Kolusu wrote:
I am guessing that VERB-1 is file-aid keyword? Not sure how it distinguishes between different language compilers (Assembler, COBOL, C++, PLI, REXX..)
My question is if I consider only VERB-1 statements for counting, then two lines, spaces(Lines without any statements) all will be handled also I need to handle the File layout/copybook into the consideration?
Joined: 15 Dec 2009 Posts: 12 Topics: 0 Location: Atlanta
Posted: Fri Feb 28, 2020 4:49 pm Post subject:
Software metrics are notoriously difficult to implement (correctly or incorrectly). As you've discovered, even something as "simple" as lines of code (LOC) isn't really that simple. If you count every line of code, how do you compare a 2,000-line program that is 75% comments to a 500-line program that has not a comment to be found? If you count only COBOL verbs (logical statements), then a significant amount of the program (the data structures) will not be represented.
Quote:
also I need to handle the File layout/copybook into the consideration?
The answer is that it depends -- if the copybook has only data definitions, and you're only counting verbs, then ignore the copybook. But if the copybook has PROCEDURE division code in it, and you're counting verbs, you have to take into account the copybook.
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Fri Apr 10, 2020 2:50 am Post subject:
As others have stated, I think you should ask the powers-that-be WHY they want that information, pointing out at the same time, the vagaries of comments, blank lines, etc.
I wrote a Rexx script that did this sort of thing (I was interested in the % of comments compared to the total number of lines).
I immediately ran into "problems" as to WHAT constituted a comment. Theoretically a line containing
Code:
*
is a comment, but it isn't really, is it? The same goes for
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum