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

How to identify Unused working storage variables


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sand
Warnings : 1

New User


Joined: 20 Nov 2005
Posts: 19

PostPosted: Tue Jan 30, 2007 2:46 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 2:54 pm
Reply with quote

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
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Jan 30, 2007 3:16 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 31, 2007 7:37 am
Reply with quote

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
View user's profile Send private message
Jude_Moss

New User


Joined: 07 Feb 2006
Posts: 1

PostPosted: Wed Jan 31, 2007 11:34 am
Reply with quote

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
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Wed Jan 31, 2007 1:50 pm
Reply with quote

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
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Jan 31, 2007 4:44 pm
Reply with quote

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
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts How to identify the transaction categ... IMS DB/DC 3
No new posts CICS vs LE: STORAGE option CICS 0
Search our Forums:

Back to Top