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 Profile Log in to check your private messages Log in
 
Replace all GOTO statements with Perform
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Oct 17, 2011 8:52 pm    Post subject: Replace all GOTO statements with Perform
Reply with quote

Hi, I have a requitrement to repalce all GOTOs with Perform. Can anyone suggest any tips for this?

thanks
Krisprems
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Oct 17, 2011 8:53 pm    Post subject:
Reply with quote

FYI, I have 500+ GoTo statements ...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Mon Oct 17, 2011 9:36 pm    Post subject: Reply to: Replace all GOTO statements with Perform
Reply with quote

Quote:
Can anyone suggest any tips for this?


unfortunately not, the only tip is... start coding icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 17, 2011 9:45 pm    Post subject:
Reply with quote

Hello,

Keep in mind that many GO TO statements are not directly replacable by a PERFORM.

Is there no real work to be done? This will probably take quite a lot of time and may introduce many problems if the testing is not most comprehensive. Is this all one program or many?

What business reason is there to do this at this point? And no, this is not a business "requirement". You may be stuck doing this, but the reason is probably just because someone wants it (and not the users).

If this is to make the code more maintainable, suggest you consider re-writing the code from the specs rather than trying to salvage the existing code.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Oct 17, 2011 9:47 pm    Post subject: Reply to: Replace all GOTO statements with Perform
Reply with quote

If you have one program with 500+ GO TOs, you'd be better off starting from scratch.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2441
Location: Netherlands, Amstelveen

PostPosted: Mon Oct 17, 2011 9:59 pm    Post subject:
Reply with quote

krisprems wrote:
FYI, I have 500+ GoTo statements ...


Going to the same statement?
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Mon Oct 17, 2011 11:22 pm    Post subject:
Reply with quote

Wait...

You realize that a PERFORM statement comes back when it's done, right? While a go to does NOT come back.

So you cant just "replace" a go to with a PERFORM. You have to change how the program flows.

Can you give a short example of one or two of the go to statements you have to replace?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue Oct 18, 2011 4:35 pm    Post subject:
Reply with quote

I don't think its worth getting too bogged down worrying about using GO TO's or not, or PERFORM THRU's. What is more relevant is what do the existing programs do?

In short, there is no direct approach. It'll take time and effort.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 965
Location: Richmond, Virginia

PostPosted: Tue Oct 18, 2011 5:13 pm    Post subject:
Reply with quote

If you do proceed, do a few at a time in one section of the program, then perform complete testing.

If you do too many and testing fails, you'll be lost.

I do presume you have a complete test plan ... ?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Oct 18, 2011 6:31 pm    Post subject:
Reply with quote

All thanks for your inputs!

cheers
Krisprems
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Oct 18, 2011 8:04 pm    Post subject: Reply to: Replace all GOTO statements with Perform
Reply with quote

That's it? No more actual detail? Leave us all hanging as to whether you ever see the light again after entering the GO-TO-Pit-of-Doom....

Good luck then :-)
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed Oct 19, 2011 3:26 am    Post subject:
Reply with quote

He must have left a go to in the wrong place!



Code:

Procedure division
    perform post-message
    perform wait-for-answers
    Go to end-interaction
    perform make-code-changes
     until changes-are-done
    perform test-changes
     until changes-are-correct
    perform post-follow-up
goback.

End-interaction.
    post thank you
    goback
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 965
Location: Richmond, Virginia

PostPosted: Wed Oct 19, 2011 5:32 pm    Post subject:
Reply with quote

Maybe he's performing everything now and keeps returning to the same place.

Reminds me of that great Star Trek time-loop episode with the poker game.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Oct 19, 2011 5:54 pm    Post subject: Reply to: Replace all GOTO statements with Perform
Reply with quote

Ph... er, Phil, Are you thinking of the episode where they were trying to throw away a boomerang?

Or was it a Frisbee?
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 965
Location: Richmond, Virginia

PostPosted: Wed Oct 19, 2011 5:58 pm    Post subject:
Reply with quote

No - An older Starfleet vessel kept coming out of a space/time thingy and they kept crashing - only to return back to the poker game after each commercial break (amazing timing in its own). Deja vu kept getting stronger, and they eventually found a way to transmit a bit of info via lt. Cmd. Data's circuitry into the next cycle that Capt. Riker's suggestion to avoid the collision was the right one.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 681
Location: Pennsylvania

PostPosted: Wed Oct 19, 2011 6:18 pm    Post subject:
Reply with quote

I was in my own time warp trying to recall Capt. Kirk playing poker with Mr. Spok.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Oct 19, 2011 8:04 pm    Post subject: Reply to: Replace all GOTO statements with Perform
Reply with quote

Mine was my latest contribution to "Give an Old Joke a New Home Week".

I suspect that Mr Spock was a bit of a wizz at "Enterprise Cobol".

Capt Kirk, as piece of wood flies off into the distance and stays away this time, "I did it!".
Mr Spock, raising one eyebrow, "According to my Tri-corder, sir, that was a stick".
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu Oct 20, 2011 12:02 am    Post subject:
Reply with quote

"Cause and Effect"

http://en.memory-alpha.org/wiki/Cause_and_Effect_%28episode%29
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Oct 20, 2011 12:56 am    Post subject:
Reply with quote

Quote:
...that Capt. Riker's suggestion to avoid the collision was the right one.


I'm intrigued (but not enough to look at the link), what, previously, did they think was better advice than "avoid the collision!"?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1775
Location: Bloomington, IL

PostPosted: Thu Oct 20, 2011 1:01 am    Post subject:
Reply with quote

Bill Woodger wrote:
Quote:
...that Capt. Riker's suggestion to avoid the collision was the right one.


I'm intrigued (but not enough to look at the link), what, previously, did they think was better advice than "avoid the collision!"?

But they wanted a JCL that would do that for them! icon_lol.gif
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PLI %IF statements Pedro PL/I & Assembler 1 Tue Sep 19, 2017 12:06 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am

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