Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REXX tool to remove dead codes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
deepak.kec

New User


Joined: 26 Feb 2007
Posts: 71
Location: bangalore

PostPosted: Thu May 14, 2009 8:18 pm    Post subject: REXX tool to remove dead codes
Reply with quote

Hi All,

Did some one has any REXX tool to remove dead codes from a cobol program?

Suggestion to write such a tool will also be helpful.

Thanks to all for providing me help and support.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Thu May 14, 2009 8:24 pm    Post subject: Reply to: REXX tool to remove dead codes
Reply with quote

Once You define exactly what You mean by "dead code"
writing such a tool would range from easy to impossible (*) icon_cool.gif

(*) looking at the source code only
Back to top
View user's profile Send private message
deepak.kec

New User


Joined: 26 Feb 2007
Posts: 71
Location: bangalore

PostPosted: Thu May 14, 2009 8:49 pm    Post subject: Dead codes
Reply with quote

i mean to say that source code which is commented out and is present along the source code.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu May 14, 2009 9:03 pm    Post subject:
Reply with quote

differentiating between comments and 'commented code' is rather difficult,
if not impossible.

Dead code is usually a reference to code that will never be executed.

removal of comments from a source module, will only reduce the size of the source module. will have no effect on the object.

but, in answer to your question.

a REXX EDIT macro easily can distinguish between comments and those lines which are not comments.
FIND 'PROCEDURE DIV' first, hoping of course that the Procedure Div statement is not in a copybook.
FIND '*' 7 will do the trick, but you have to insure that the bounds include the lineno columns (1-6).
find_RC = RC
create a do loop
if find_rc <> 0 then exit the loop
you could then load the source line via an ISPF Macro LINE command.
once into a REXX variable the fun begins.
How to interrogate the data in the variable to determine if it is indeed 'commented code' or a real comment?

Once you have determined if it is 'dead code', you can issue an ISPF Macro DELETE .zcurr
then as last instruction in the DO Loop, F '*' 7 next
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2086
Location: Silicon Valley

PostPosted: Thu May 14, 2009 9:35 pm    Post subject: Reply to: REXX tool to remove dead codes
Reply with quote

Does your 'dead code' really happen that often that you need to write a program?

I suggest excluding all the lines, then find all with '*' in col 7 (or whatever it is) then scroll up and down while deleting the problem lines.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri May 15, 2009 9:02 am    Post subject:
Reply with quote

I don't remember which version of COBOL it was, but I remember seeing a compile listing where dead code was documented at the bottom of the listing. It could then be removed manually. Why write a REXX program if the compiler will spot it for you?
Back to top
View user's profile Send private message
deepak.kec

New User


Joined: 26 Feb 2007
Posts: 71
Location: bangalore

PostPosted: Fri May 15, 2009 1:19 pm    Post subject: Cobol 2
Reply with quote

We use Cobol version 2 but the compiler doesn't document the dead code at the bottow.

Dead Code are the redundant code which have been commented and are of no use now.


thanks Dick Brenholtz. Hope ur suggestion helps me icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri May 15, 2009 3:12 pm    Post subject:
Reply with quote

This link talks about a similar topic: http://www.ibmmainframes.com/viewtopic.php?t=35505&highlight=unused
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri May 15, 2009 6:25 pm    Post subject:
Reply with quote

The "dead code" I was referring to is code that will never be executed because of the logic coded, for instance a paragraph that is never performed or cannot be executed because of "fall through" logic. The compiler stated that no instructions were generated in the object module since the code will never be executed.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm
No new posts Mainframe scheduling tool ddhar Compuware & Other Tools 2 Wed Sep 27, 2017 12:48 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us