Counting Lines of Code in all the members of the PDS
Hi,
I need to count the lines of code of all the Cobol programs present in a PDS. I have tried REXX and SELCOPY, the results are okay, but the execution time is very high. I wanted to do this through Focus procedures. Is it possible to get a report in the following way using Focus procedure in batch/online:
PDS: userid.cobol.programs
Member LineCount Program1 2394 Program2 994 Program3 9342 Program4 1263
where Program1...etc are the members of the PDS userid.cobol.programs
Many thanks for your help.
FOCUS 7.2.3 Platform: IBM system Z9 Business class O/P formats: Flat files, excel and CSV files
April 11, 2008, 09:29 AM
GinnyJakes
Shrikant,
I do this sort of thing in a Unix environment all the time. The first thing you need is a generic master that I call LINE80.
Then you need some sort of operating system command (maybe LISTMEM) that lists the members of the PDS and you have to pipe the output to a file. You might be able to use APP commands.
quote:
APP QUERY app HOLD Writes a list of all files in the directory app to a file focappl.ftm in EDATEMP; the output is described by focappq.mas.
You would have to set the APP PATH first to point to only that directory.
Next (assuming we are using APP QUERY), TABLE focappq and write the focexec names to a SAVE file.
Then filedef an output file, let's call it FEXCOUNT, and make sure that you have (APPEND at the end of the filedef. You are going to be building this file as you go.
Then set up a loop using -REPEAT and -READ to loop through the SAVE file. For each entry, filedef the master LINE80 to this member of the PDS. Then,
DEFINE FILE LINE80
FEXNAME/A8='&FEXNAME';
END
TABLE FILE LINE80
COUNT LINE80 AS LINECNT
BY FEXNAME
ON TABLE HOLD AS FEXCOUNT FORMAT ALPHA
END
Then loop and get the next one.
When you are done, the file FEXCOUNT contains a list of all the focexecs and the number of lines in each.
I don't know if this will be any faster but it is certainly doable. This is just a mix of Dialogue Manager, APP commands, filedefs, and TABLE.
I could write the code for you but that would take all the fun out of it for you. Give it a try.