IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Use GO BACK instead of STOP RUN


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
santy
Warnings : 1

New User


Joined: 19 Jul 2007
Posts: 22
Location: mumbai

PostPosted: Tue Sep 23, 2008 12:32 pm
Reply with quote

What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Sep 23, 2008 12:36 pm
Reply with quote

Dont you think such questions you should try out first and then if post if you stuck somewhere???
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Sep 23, 2008 12:37 pm
Reply with quote

Hello,

The program will end. Many system standards dictate only goback be used (rather than stop run).

GOBACK terminats the current executing code and returns control to the code that invoked it (this could be a calling program or the operating system).

STOP RUN terminates the run unit - sometimes rather ungracefuly.
Back to top
View user's profile Send private message
santy
Warnings : 1

New User


Joined: 19 Jul 2007
Posts: 22
Location: mumbai

PostPosted: Tue Sep 23, 2008 12:41 pm
Reply with quote

but as it is stand-alone program, program will may b went to infinte loop also?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Sep 23, 2008 12:47 pm
Reply with quote

Quote:

but as it is stand-alone program, program will may b went to infinte loop also?

if you thinking GOBACK will call same program again then you are wrong.
is there any other reason that you are thinking so?[/code]
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Tue Sep 23, 2008 1:05 pm
Reply with quote

santy wrote:
but as it is stand-alone program, program will may b went to infinte loop also?
Unless there is a flaw in the logical flow..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 23, 2008 4:53 pm
Reply with quote

From the Language Reference:
Quote:
6.2.17 GOBACK statement


The GOBACK statement functions like the EXIT PROGRAM statement when it is coded as part of a called program (or the EXIT METHOD statement when it is coded as part of an invoked method) and like the STOP RUN statement when coded in a main program.
If the program executes the GOBACK there is no infinite loop possible as the code is complete. If there is an infinite loop, the GOBACK is not being invoked.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Tue Sep 23, 2008 6:17 pm
Reply with quote

The Goback won't cause pgm to go infinite loop

Just understand purpose of STOPRUN and GOBACK first

STOP RUN - Will pass control to OS(operating system)
GOBACK - will pass control to Calling program

In above acenario, we are having GOBACK for Standalone program so when GOBACK executed, it will look out pgm which is calling since it is not calling it gives control back to OS..

So there is no question of Looping here, Pgm will execute succesfully

Hope you are clear
Back to top
View user's profile Send private message
santy
Warnings : 1

New User


Joined: 19 Jul 2007
Posts: 22
Location: mumbai

PostPosted: Wed Sep 24, 2008 10:38 am
Reply with quote

thanks,

now i clear my all doubts.... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Back Page print direction (Duplex Pri... JCL & VSAM 3
No new posts How to stop a runaway CICS trans with... CICS 13
No new posts Query regarding STOP REGION XX ABDU... IMS DB/DC 11
This topic is locked: you cannot edit posts or make replies. Data Sets are files. Please stop str... JCL & VSAM 11
Search our Forums:

Back to Top