Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to identify Unused working storage variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: How to identify Unused working storage variables
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 2:54 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Could we identify the called modules ... elixir1986 COBOL Programming 5 Fri Jul 14, 2017 1:53 am
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts GETMAIN / FREEMAIN versus STORAGE OBT... steve-myers PL/I & Assembler 8 Wed Feb 01, 2017 1:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us