View previous topic :: View next topic
|
Author |
Message |
sand Warnings : 1 New User
Joined: 20 Nov 2005 Posts: 19
|
|
|
|
How efficiently (not by manually searching in actual code of a Cobol program) we can identify unused variables in the program which are defined in working storage section and not used anywhere in the procedure division? These variables are not part of any copybook.
Thanks,
Sand |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The compiler (used to?) creates a listing of all data names and which line of the procedure division that they were referenced. I have used that list, comparing the unused data names against the actual data division listing to identify unused data names. Watch out for redefined names..... |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
William Thompson wrote: |
The compiler (used to?) creates a listing of all data names and which line of the procedure division that they were referenced. |
You can flag XREF option to indicate the compiler to create a listing... |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Be careful. Consider the following:
01 grp-var.
05 el-var1 pic....
05 el-var2 pic....
el-var1 is never used. Do you take it out?
If you're doing it for 1 or 2 pgms, no big deal. A couple of hundred or thousand - tough job. |
|
Back to top |
|
|
Jude_Moss
New User
Joined: 07 Feb 2006 Posts: 1
|
|
|
|
In my previous project , we used SmartDoc ( ASG Tools) which produces a report in .HTML format. which tells us
1.Dead code (working storage variable/code)
2.Cyclomatic complexity of the program etc.
Regards,
Jude |
|
Back to top |
|
|
Santoshdorge
New User
Joined: 27 Jun 2006 Posts: 48 Location: Pune
|
|
|
|
I have one way to do it manually.It's not a efficient way to do it but
would work for you.Use find all commad for group level in descending order(eg first for 01 then 02 so on ) and accordingly remove the ws section entry if any item is not used by group name or individualy. |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
Jude_Moss wrote: |
In my previous project , we used SmartDoc ( ASG Tools) which produces a report in .HTML format. which tells us
1.Dead code (working storage variable/code)
2.Cyclomatic complexity of the program etc.
Regards,
Jude |
or you can browse it in host as the VIASDRPT is the input to the html conversion step. |
|
Back to top |
|
|
|