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
 
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

Senior Member


Joined: 14 Mar 2007
Posts: 10535
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: 7314

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: 2463
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: 975
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: 7314

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: 975
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: 7314

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: 975
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: 714
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: 7314

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: 7314

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: 1790
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 Silly question maybe - REPLACE member... Cloink TSO/ISPF 15 Thu Oct 25, 2018 6:38 pm
No new posts Replace comp-3 field value to comp-3 ... dharmaraok DFSORT/ICETOOL 5 Fri Sep 14, 2018 3:46 pm
No new posts USS: Find and replace string within a... vasanthz All Other Mainframe Topics 5 Thu Aug 02, 2018 4:01 am
No new posts Remove all Parenthetical Statements -... JayaprakashT DB2 2 Fri Apr 27, 2018 3:57 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am

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