Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
Replacing GO TO Statements

Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message

New User

Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue Dec 02, 2014 5:28 pm    Post subject: Replacing GO TO Statements
Reply with quote

My management as part of a COBOL standard that they introduced recently wants to replace all the GO TO statements. They have blindly said 'No GO TOs please for any of the new as well as the existing programs'.
There are more than 600+ Cobol programs having GO TOs in them which they want to be changed. This changing of GO TOs for the existing program does not make any sense to me as they work perfectly well now and they could have said they want it to be implemented for new programs.

Just wanted to know if there would be any way this can be done without me getting to analyse all the GO TO statements in each of the 600+ programs making sure that I dont tamper with the existing functionality.

Any suggestion in this regard would be highly appreciated.

Thank you!
Back to top
View user's profile Send private message

Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Tue Dec 02, 2014 5:50 pm    Post subject: Reply to: Replacing GO TO Statements
Reply with quote

It will be very costly to analyse, change and test 600 programs to remove GO TOs and subsequently ensure that their behaviour is identical.

However, if that is what is ordered, then presumably the large cost (both in financial terms and in analysis/development/testing resources) has already been accepted.

There are no shortcuts. Unless you are lucky.

If, for instance, the only use of GO TO is to get to a fatal-error routine, then replacing the GO TO by a PERFORM will do (the fatal error generated will ensure there is no return from the PERFORM)..

However, it is much more likely that the GO TOs are in ordinary code, and that to post facto avoid their use will require sufficient restructuring as to require considerable amounts of testing.

He who pays the Piper calls the tune. But do they really know the cost? To achieve what, for that cost?

I've never heard of going back and removing GO TOs from all programs. For major changes to an existing program, it is reasonable to consider, since the testing can cover those changes as well. For small-to-medium changes to existing programs, it is not "worth" upsetting the existing program, in general.

If your company has money, resources and time to burn then OK (and get them to contact me, I don't mind making the changes in such situations of largesse).

For new programs, entirely reasonable. For existing programs not under major change, let's be polite and say it is a "questionable" idea at best.

PM me for contact and bank account details.
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: Tue Dec 02, 2014 7:46 pm    Post subject:
Reply with quote

Bill brings up valid points, but I'd like to add another. The cost of replacing GO TOs should be weighed against the cost of maintaining those programs as is. Many of us have dealt with programs written decades ago and have been modified by numerous developers with numerous coding styles. The longer these programs exist the more difficult they become to understand because of those reasons. Advancement of COBOL functions have not always been taken advantage of. One option woud be to deal with these programs one at a time when other changes are required instead of biting the bullet with all 600 at one time.
Back to top
View user's profile Send private message


Joined: 07 Sep 2006
Posts: 1568
Location: Andromeda Galaxy

PostPosted: Tue Dec 02, 2014 8:26 pm    Post subject:
Reply with quote

Replacing GO TO could change the way the program was created.

Having said no GO TO in the new programs is a better idea.

But replacing all GO TO in existing programs is not a good idea.

I personally feel it is not worthy at all .. Assuming it will just take 2 hrs to do the analysis & change and 1 hr to do the promote and 1 hr for documentation and 1hr to retest .. 600 * 5 = 3000 hrs..

Assuming you work for 10 productive hrs a day = 300 days

Its just not worth it
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1


Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts special characters pipes "|"... VINAY PALLELA COBOL Programming 1 Mon Jun 08, 2020 9:19 am
No new posts filter COMMIT/ROLLBACK statements jzhardy DFSORT/ICETOOL 13 Fri May 01, 2020 5:27 pm
No new posts Rexx to create VSAM define statements Dinesh Mani CLIST & REXX 10 Fri Nov 29, 2019 9:26 pm
No new posts Summing records conditional statements. chillmo SYNCSORT 13 Wed May 15, 2019 2:12 am
No new posts Remove all Parenthetical Statements -... JayaprakashT DB2 2 Fri Apr 27, 2018 3:57 am

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