IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Count lines for 200 programs in PDS


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harish5002

New User


Joined: 21 Jul 2010
Posts: 23
Location: chennai

PostPosted: Wed Jan 16, 2013 5:27 pm
Reply with quote

Hi,

Can u please guide me how to write the above code. I got the same requirement to find the lines of code for more than 200 programs. So please suggest me any jcl or how to write the code for ISPF panel.

Thanks in advance to all....
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed Jan 16, 2013 5:39 pm
Reply with quote

why the fluck reinvent the wheel, aren' t ISPF statistics good enough
( whatever the use for them )

anyway the LOC ( lines of code ) counting is a murky issue ... what do You define as line of code ???

some smart*** might raise its LOC productivity by simply reformatting a program ...

instead of
Code:
call something ( parm1, parm2, ..., parmn )


Code:
call something ( parm1,
     parm2,
     ...,
     parmn)


would raise the productivity by 300%
icon_cool.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 16, 2013 5:39 pm
Reply with quote

Please don't tailgate an old topic, but instead start a new one.

What "programs" do you have? Is it a library with ISPF statistics? What actual use does anyone feel that this is?

I can write like this:

Code:
MOVE A TO B. MOVE B TO C. MOVE C TO D.


or

Code:
MOVE
A
TO
B
MOVE
B
TO
C
MOVE
C
TO
D


Or somewhere "in between". Makes not one jot of difference to what the program does.

Nor does this:

Code:
 

but it can make the code easier to read. If I were to be paid by "lines" I'd consider making my programs much "easier to read" :-)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed Jan 16, 2013 5:40 pm
Reply with quote

Hi Bill!
our low esteem for the bean counters made our posts cross over

but I strongly agree that proper reformatting for readability should have the precedence
( after correctness naturally )

but even the dummyiest LOC counter would ignore the completely blank lines icon_wink.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 16, 2013 6:28 pm
Reply with quote

Hi enrico!

I was trying to get across the lack-of-use in "counting" lines, of course.

Blank lines and comments should "go" to approach something sensible, but then also there should be code to deal with what you and I used as examples. So a "micky mouse" counting program, to have worth, has to become the first stage of a compiler. Then you go through all that and the "user" says "Oh, I just wanted a figure for a talk I'm giving to the Board, it doesn't have to be accurate". It can never be "accurate". Sometimes it may be best to code with only a few lines, others it would be best to code with more. You can't just "count" lines and produce any meaningful output, no matter how accurate.

I think we agree on that already...

So if it is a "pointless" task, and already has ISPF Statistics, it is a "good" time to use them :-)
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Wed Jan 16, 2013 6:46 pm
Reply with quote

I like code metrics. They're kind of like sports statistics, fun to argue about but essentially meaningless.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 2:14 am
Reply with quote

So for curiosity, assume these 200 PDS Members were added into your system with no ISPF statistics (STATS OFF) and you were asked to provide how many lines of code were in each Member - how would you do it in CLIST/REXX or some JCL Utility?
Of course even turning the STATS ON will not give you the Size (amount of lines) for the member [need to make a change to see Size].
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 17, 2013 2:34 am
Reply with quote

I beg to disagree
it would be enough to go to option 3.5

Code:
   Menu  RefList  Utilities  Help
 ──────────────────────────────────────────────────────────────────────────────
                             Reset ISPF Statistics         Enter required field
 Option ===>

 R Reset (create/update) ISPF statistics   D Delete ISPF statistics

 New Userid  . . . . . .          (If userid is to be changed)
 New Version Number  . .          (If version number is to be changed)

 SCLM Setting                               Enter "/" to select option
 3  1. SCLM   2. Non-SCLM   3. As is        /  Reset Mod Level
                                            /  Reset Sequence Numbers
 ISPF Library:                              /  Reset Date/Time
    Project . . .                           /  Reset Number of Lines
    Group . . . .
    Type  . . . .
    Member  . . .                 (Blank or pattern for member selection
                                   list, "*" for all members)
 Other Partitioned Data Set:
    Name  . . . . . . .
    Volume Serial . . .           (If not cataloged)

 Data Set Password  . .           (If password protected)
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 5:25 pm
Reply with quote

Well, that's true 3.5 can turn-on the STATS.

But in the spirit of the original poster how would this be done in CLIST/REXX or some JCL Utility? I can't think of a JCL utility to present the PDS Members with the count/Size.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 17, 2013 5:30 pm
Reply with quote

Quote:
But in the spirit of the original poster how would this be done in CLIST/REXX or some JCL Utility?


that' one of my pet peeves

if somebody asks for a solution using a predetermined tool
it means that such somebody had completed the due diligence

tool comparison, pro's, con' s,
and has checked the availability of the proper skills

so it should not need to ask for anything.

and nobody on a forum will waste time reinventing the wheel and writing code
especially for a unreasonable requirement
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Jan 17, 2013 6:45 pm
Reply with quote

One easy way to determine the size of each member of a PDS is to use SUPERC's SRCHFOR to find a string that you are certain will not be found in the PDS. The LNFMTO option (List "not found" member totals only) will create a summary listing the member name plus the number of records searched in each member (which is of course the size). For example:
Code:
//SEARCH  EXEC PGM=ISRSUPC,       
//            PARM=(SRCHCMP,     
//            'ANYC,LNFMTO')     
//NEWDD  DD DSN=XXXX.MASTER.SOURCE
//          DISP=SHR             
//OUTDD  DD SYSOUT=(*)           
//SYSIN  DD *                     
SRCHFOR  X'FF'                   
/*                               

The report looks like this:
Code:

MEMBER-SEARCHED         LINES-FOUND   LINES-PROC
                                               
CAL11M                          0           62 
CAL11T                          0           62 
CAL11X                          0           62 
XXXSABEND                       0           95 
XXXACVOL                        0         1209

The summary at the end of the report tells you the total number of lines searched.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 17, 2013 6:47 pm
Reply with quote

pretty smart trick icon_wink.gif
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 6:50 pm
Reply with quote

Quote:
nobody on a forum will waste time reinventing the wheel and writing code
especially for a unreasonable requirement

Actually our IT Testing area has a similar requirement as the original poster looking for "something" (i.e. clist/REXX, JCL Utility) to provide ID Stats of the last person to make a member update along with Size/count of the member(s). We want it reported (email) on a daily basis. Of course it's easy to do this manual process by sorting PDS by Change date in descending order but I was looking for an automated way to produce the report since we have 50+ PDS datasets to review.

We never found that "something" to get us the PDS STATistics we needed automatically. We currently have a work-around where one of my contract programmers on a daily basis does the manual process mentioned above. In our case, this is not an unreasonable requirement.

I probably should have just started a new post but as I mentioned this post was very similar to our requirement.

Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 17, 2013 6:58 pm
Reply with quote

IEBPTPCH and then whatever you like.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Thu Jan 17, 2013 7:20 pm
Reply with quote

Quote:
We never found that "something" to get us the PDS STATistics we needed automatically.


ISPF updates the statistics AUTOMATICALLY

to do automatically something according to Your whims is asking too much icon_cool.gif

ISPF provides the LM.... and LMM.... services to extract the statistics

pretty easy to do it

here is a posts discussing some of it
www.ibmmainframes.com/viewtopic.php?t=52204&highlight=lmmlist
and

did not take more than 10 minutes to test a silly snippet

Code:
 EDIT       ENRICO.ISPF.EXEC(ZSTATS) - 01.01                Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"
 000005
 000006 Parse Source _sys _how _cmd .
 000007
 000008 If Sysvar(SYSISPF) \= "ACTIVE" Then Do
 000009    Say left(_cmd,8)"- Ispf is not active. Command not executed"
 000010    Exit 4
 000011 End
 000012
 000013 call $ispex "CONTROL ERRORS RETURN"
 000014
 000015 if  $isred("MACRO (ZPARMS) NOPROCESS ") = 0 then do
 000016     _parms = strip(translate(zparms))
 000017 end
 000018 else do
 000019     zerrsm = "Invocation ERROR"
 000020     zerrlm = left(_cmd,8)"- Must be invoked as an edit macro"
 000021     call   $ispex "SETMSG MSG(ISRZ002) "
 000022     Exit 1
 000023 end
 000024
 000025 call $isred "(DATASET) = DATASET"
 000026 call $isred "(CURRNT)  = MEMBER"
 000027 call $isred "(DATAID)  = DATAID"
 000028
 000029 lm0_rc = $ispex("LMOPEN DATAID("dataid") OPTION(INPUT) ")
 000030
 000031 member = ""
 000032
 000033 lmmopts  = "OPTION(LIST) STATS(YES)"
 000034 lmmlist  = "LMMLIST DATAID("dataid") MEMBER(MEMBER) " lmmopts
 000035 do while ($ispex(lmmlist) = 0 )
 000036    say left(member,8) left(zluser,8)
 000037 end
 000038
 000039 lm0_rc = $ispex("LMMLIST DATAID("dataid") OPTION(FREE) " )
 000040 lm0_rc = $ispex("LMCLOSE DATAID("dataid") " )
 000041
 000042 Exit
 000043
 000044 /*  */                                                               */
 000045 $ispex:
 000046    isp_0tr = trace("O")
 000047    Address ISPEXEC arg(1)
 000048    isp_0rc = rc
 000049    trace value(isp_0tr)
 000050    return isp_0rc
 000051
 000052 /*  */
 000053 $isred:
 000054    isr_0tr = trace("O")
 000055    Address ISREDIT arg(1)
 000056    isr_0rc = rc
 000057    trace value(isr_0tr)
 000058    return isr_0rc
 000059
 000060 /*  */
 000061 $tsoex:
 000062    tso_0tr = trace("O")
 000063    Address TSO arg(1)
 000064    tso_0rc = rc
 000065    trace value(tso_0tr)
 000066    return tso_0rc
 000067
 ****** **************************** Bottom of Data ****************************


just as a POC I displayed only the ZLUSER

just a couple more statements to check if the stats are ON for a member
and display all the relevant stats fields
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 7:35 pm
Reply with quote

Bill Woodger wrote:
IEBPTPCH and then whatever you like.

Thanks, but IEBPTPCH does not give STATistics. It reprots the PDS Member data.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 7:53 pm
Reply with quote

Quote:
ISPF updates the statistics AUTOMATICALLY
By AUTOMATICALLY, as my post noted, I was referring to an automated email report we would like produced daily - not MANUALLY reviewing 50+ PDS datasets for the STATistics as we do today.

Quote:
to do automatically something according to Your whims is asking too much
Too funny! I'm in the companies IT Automated Testing group which is why I was looking for "something" for our requirement.

Hey, thanks for the ZSTATS REXX. I'll give a try hopefully soon.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 17, 2013 8:19 pm
Reply with quote

Ah. Didn't notice you were an "interloper" with a different question, I just thought you were the Devil's Advocaat :-)
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2594
Location: Silicon Valley

PostPosted: Thu Jan 17, 2013 10:42 pm
Reply with quote

Quote:
to provide ID Stats of the last person to make a member


If this is an accountability issue... you should be aware that the userid and time of last update are not secure fields. Anybody with update authority can set bogus information in those fields.

You can use the LMMSTATS service to set ISPF statistics. Or just use ISPF option 3.5.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Thu Jan 17, 2013 11:52 pm
Reply with quote

Yea, I am aware date/time of last update and userID are not secure fields. Of course setting bogus information for these datasets in our company is also grounds for dismissal.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts CA7 count with DATE variable CA Products 0
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top