View previous topic :: View next topic
|
Author |
Message |
Akash Sharma
New User
Joined: 13 Jan 2009 Posts: 36 Location: India
|
|
|
|
Hi All,
Is it possible to write a code in REXX or CLIST which would could perform following operation:
1. Input: PDS Name
2. Functionality: Compute number of lines of code for each member in that PDS.
3. Output: A report in following format.
Code: |
PDS: DEV.BAT.SOURCE
PROGRAM NAME LOC
PROG1 000456
PROG2 001173
PROG1 008702
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Yes, of course. It'll have to be up to you to determine what constitutes a "line of code" and how to count it. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Search for "LOC" to find other similar topics. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Akash Sharma
New User
Joined: 13 Jan 2009 Posts: 36 Location: India
|
|
|
|
HI Dick,
Thanks a lot for the effort and time u have put in replying to the query.
Well, a beginner just expects that some pro could give him a clue whether it is possible or not. I have looked into previous posts for LOC and then posted a new one.
Thanks anyway. Help is much appreciated. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
a beginner just expects that some pro could give him a clue whether it is possible or not. |
If you want lines of text, it is fairly easy. Search the ISPF manuals for the LMMLIST service.
Lines of code is not well defined. For example, some lines might be continued to another line. Is it counted as one line of code or two? Are comments considered lines of code? |
|
Back to top |
|
|
Akash Sharma
New User
Joined: 13 Jan 2009 Posts: 36 Location: India
|
|
|
|
Hi Pedro,
Quote: |
Is it counted as one line of code or two? Are comments considered lines of code?
|
Yes, Comments are considered in LOC and continuation of a command in second line also considered as 2 lines.
Its just counting no. of lines in a program blindly.
Thanks for the help. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
LMMLIST relies on the ISPF statistics being turned on. Sometimes they are not. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Akash,
Though belated I think I have solution for your problem, let me know if this solves your problem
/*REXX*/
/*ARG DSN */
DSN='XXXX.YYYY.ZZZZ'
DSN0='AAAA.BBBB.CCCC'
ADDRESS TSO "ALLOC DA('"DSN0"') DD(OUTDD) MOD REUSE"
"EXECIO 0 DISKW OUTDD (OPEN" /* OPEN INDD */
X = OUTTRAP('VAR.')
"LISTDS '"DSN"' MEMBERS"
G = 0
/*SAY 'THE NUMBER OF LINES TRAPPED IS' VAR.0 */
DO I = 7 TO VAR.0
MEM=DSN || '(' || STRIP(VAR.I) || ')'
DSE=SYSDSN("'"MEM"'")
IF DSE <> 'OK' THEN
"FREE DD(INDD)"
ADDRESS TSO "ALLOC DA('"MEM"') DD(INDD) SHR REUSE"
EOFFLAG = 2 /* RETURN CODE TO INDICATE END-OF-FILE */
RETURN_CODE = 0 /* INITIALIZE RETURN CODE */
IN_CTR = 0 /* INITIALIZE # OF LINES READ */
"EXECIO 0 DISKR INDD (OPEN" /* OPEN INDD */
DO WHILE (RETURN_CODE ¬ = EOFFLAG) /* LOOP WHILE NOT END-OF-FILE */
'EXECIO 1 DISKR INDD' /* READ 1 LINE TO THE DATA STACK */
RETURN_CODE = RC /* SAVE EXECIO RC */
IF RETURN_CODE = 0 THEN /* GET A LINE OK? */
DO /* YES */
IN_CTR = IN_CTR + 1 /* INCREMENT INPUT LINE CTR */
PARSE PULL LINE.1 /* PULL LINE JUST READ FROM STACK*/
END
END
SAY IN_CTR
G = G + 1
REPORT.G = MEM || ''LINES OF CODE'' IN_CTR
"EXECIO 0 DISKR INDD (FINIS" /* CLOSE THE INPUT FILE, INDD */
"FREE FI(INDD)"
END
X = OUTTRAP('OFF')
DO M = 1 TO G
END
'EXECIO 'G 'DISKW OUTDD(FINIS STEM 'REPORT.
"FREE FI(OUTDD)"
EXIT
END |
|
Back to top |
|
|
Akash Sharma
New User
Joined: 13 Jan 2009 Posts: 36 Location: India
|
|
|
|
Prasad,
Thanks a lot for the code.
In the meantime i was too working on it.
The below code which i wrote is working too...
I have also written an ISPF Panel from where im taking the PDS name as input...performing some validations on it.
Code: |
X = OUTTRAP(LISTMEM.,"*")
"LISTDS '"DASN"' MEM " /* DASN--> PDS NAME
DO CNT = 7 TO LISTMEM.0
MCNT = MCNT + 1
MEM = STRIP(LISTMEM.CNT)
LOC.MCNT = MEM
PDS=DASN'('MEM')'
"ALLOC DA('"PDS"') F(INDD4) SHR REUSE"
"EXECIO * DISKR INDD4 (STEM MEMLOC. FINIS"
FINVAR.MCNT = DASN || ' ' || MEM || ' ' || MEMLOC.0
MLOC = MLOC + MEMLOC.0
END
|
Here MLOC gives a total count count of LOCs in the PDS... |
|
Back to top |
|
|
|