View previous topic :: View next topic
|
Author |
Message |
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Hi, I have a requitrement to repalce all GOTOs with Perform. Can anyone suggest any tips for this?
thanks
Krisprems |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
FYI, I have 500+ GoTo statements ... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
Can anyone suggest any tips for this? |
unfortunately not, the only tip is... start coding |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you have one program with 500+ GO TOs, you'd be better off starting from scratch. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
krisprems wrote: |
FYI, I have 500+ GoTo statements ... |
Going to the same statement? |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
All thanks for your inputs!
cheers
Krisprems |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I was in my own time warp trying to recall Capt. Kirk playing poker with Mr. Spok. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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! |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
There were alternate opinions of how to move the ship out of the way. Enterprise was without warp drive or impulse drive. Riker's suggestion was to pop open the shuttle bay and let the rush of air jet-propel the ship out of the way. The other option was to use the tractor beam.
Since data had kept seeing the number "3", he went with Riker's option because Riker has three pips on his collar.
I messed up the above link...here is the correct link:
http://en.memory-alpha.org/wiki/Cause_and_Effect_%28episode%29 |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
Ed has answered - thanks.
I'll add: previously Riker made his suggestion each time, but Data overrode it each time, leading to catastrophe. Finally, as Ed says, the clue transmitted to the final loop led Data to take Riker's idea.
A GREAT show if you ask me. Someone asked, right?
Oh, now I remember, the question was about GOTO and PERFORM!
hahahahahahaha |
|
Back to top |
|
|
|