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
 

 

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: 10256
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: 6967
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: 2038
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am


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