Focal Point
Counting Lines of Code in all the members of the PDS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6861040082

April 11, 2008, 06:37 AM
Shrikant
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.
FILE=LINE80       ,SUFFIX=FIX
SEGNAME=LINE80,SEGTYPE=S01
FIELDNAME=LINE80, ALIAS=LN80 ,FORMAT=A80, ACTUAL=A80,$

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.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
April 13, 2008, 06:17 PM
Waz
I'm sure I did this 15-20 yeasrs ago, with a master that could read PDS's, you could get the name and length of each member.

Just did a quick search of Techsupport, seems it was called FOCMAP.

Another possibility, what do you get if you use APP MAP, APP QUERY ?

This message has been edited. Last edited by: Waz,


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!