MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get Line of code for each application

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Feb 24, 2020 1:08 pm    Post subject: How to get Line of code for each application Reply with quote

Hi,

I am trying to fetch LOC(lines of code) for each application.

I have programs in PDS, the goal is to identify LOC.

Code:

//IEBPTPCH EXEC PGM=IEBPTPCH                                     
//SYSUT1    DD DSN=PDS,DISP=SHR                     
//SYSUT2    DD DSN=PS,DISP=(,CATLG,DELETE),UNIT=SYSDA, 
//      SPACE=(CYL,(400,400),RLSE)                               
//SYSPRINT DD SYSOUT=*                                           
//SYSIN      DD *                                               
  PUNCH TYPORG=PO                                               
/*                                                               


this will move all PDS member to a PS, but this is taking too much time, is there a way to do it quickly.

Please advise.

thanks
Magesh
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Feb 24, 2020 1:32 pm    Post subject: Reply with quote

File aid utility is much faster, found it mvsforum itself.

MVSforumLink

Code:

//STEP0100 EXEC PGM=FILEAID               
//*                                       
//SYSLIST  DD SYSOUT=*                   
//SYSPRINT DD SYSOUT=*                   
//SYSUDUMP DD SYSOUT=*                   
//DD01     DD DSN=PDS,         
//            DISP=SHR                   
//SYSIN    DD *                           
$$DD01 TALLY                             
/*                                       


Thanks
Magesh
Back to top
View user's profile Send private message
Spolacek
Beginner


Joined: 17 Dec 2002
Posts: 17
Topics: 2
Location: NJ, USA

PostPosted: Mon Feb 24, 2020 3:59 pm    Post subject: Reply with quote

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.

Code:
//STEP01 EXEC PGM=FMNMAIN                         
//DDIN     DD DSN=PDS,                             
//            DISP=SHR                             
//DDOUT    DD DSN=NULLFILE,                       
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)   
//SYSIN    DD *                                   
$$FILEM DSC INPUT=DDIN,OUTPUT=DDOUT               
/*                                                 
//FMNTSPRT DD SYSOUT=H                             
//SYSPRINT DD SYSOUT=H                             
//SYSUDUMP DD SYSOUT=H


This is what the output report looks like:

Code:

                                                  Member Copy Report         
Member         Newname    Alias      Status                            Recs in
------------------------------------------------------------------------------
AAAA                                 Copied                               1093
BBBB                                 Copied                                715
CCCC                                 Copied                                259
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Feb 24, 2020 4:07 pm    Post subject: Re: How to get Line of code for each application Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Feb 24, 2020 4:51 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Feb 24, 2020 5:41 pm    Post subject: Reply with quote

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.

Something like this
Code:

//STEP0100 EXEC PGM=FILEMGR                       
//SYSPRINT DD SYSOUT=*                           
//DDIN     DD DISP=SHR,DSN=Your PDS
//DDOUT    DD DUMMY                               
//SYSIN    DD *                                   
$$FILEM DSC INPUT=DDIN,                           
$$FILEM PROC=*                                   
*REXXPROC                                         
SETN(MYNUM,'+1','COUNT OF RECORDS ')             
/*


at the end of sysprint you will have something like this
Code:

TALLY summary report                     
------------------------------------------
COUNT OF RECORDS     2460884             

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Feb 24, 2020 5:55 pm    Post subject: Reply with quote

Kolusu wrote:
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

is file layout is considered as a loc ?

Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Feb 24, 2020 11:47 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Fri Feb 28, 2020 12:08 pm    Post subject: Reply with quote

kolusu wrote:
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


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..)


VERB-1 is in compiler listing at position 99.

Code:

=COLS> ---+----7----+----8----+----9----+----0----+----1----+----2----
003276 IC  X(002).                     XXXXXXX              8         
003277 6:49:44 13-MAR-17  PAGE    57        VERB-1     ADDR-1 VERB-   
003278 +----5----+----6----+----7-|--+----8                           
003279                                                               
003280                             XXXXXXX                           
003281                             XXXXXXX                           
003282                             XXXXXXX                           
003283                                                               
003284 .                                    MOVE       0025AC         
003285                                                               
003286                                      PERFORM    0025B6         
003287                                                               
003288                                      STRING     0025D2         


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?

Thanks
Magesh
Back to top
View user's profile Send private message
Robert Sample
Beginner


Joined: 15 Dec 2009
Posts: 12
Topics: 0
Location: Atlanta

PostPosted: Fri Feb 28, 2020 4:49 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Apr 10, 2020 2:50 am    Post subject: Reply with quote

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
Code:

      /

As you yourself pointed out, compare
Code:

      move 10 to x

to
Code:

      move
         10
           to
          x

One line or 4 ???
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group