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
 
Use GO BACK instead of STOP RUN

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Use GO BACK instead of STOP RUN
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    Post subject:
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

Site Director


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

PostPosted: Tue Sep 23, 2008 12:37 pm    Post subject:
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    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Tue Sep 23, 2008 1:05 pm    Post subject:
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: 8152
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 23, 2008 4:53 pm    Post subject:
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    Post subject:
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    Post subject:
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    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 CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Stop Process when file is empty Roland Brosio DFSORT/ICETOOL 4 Thu Jun 25, 2015 1:20 pm
No new posts Need a JCL to change the volume back ... Manikandesvaran D JCL & VSAM 10 Tue Oct 14, 2014 9:06 pm
No new posts Go Back (F3) has to be automized sakrat TSO/ISPF 7 Tue May 06, 2014 12:30 pm
No new posts Parse a String and divide it by 2 and... magesh23586 CLIST & REXX 6 Fri Feb 07, 2014 11:34 pm

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