GO BACK in stand alone COBOL program

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
diwz
Member
Posts: 44
Joined: Sun Feb 10, 2013 10:39 am

GO BACK in stand alone COBOL program

Post by diwz » Tue Feb 12, 2013 1:58 pm

I wrote a standalone cobol program with GO BACK.

The program execute successfully in TSO. But I felt the GO BACK should go in infinit loop as the cobol program is the stand alone.

Can any one clarify me this.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Feb 12, 2013 4:50 pm

The manuals can help you. Look at GOBACK (one word) STOP RUN (two words) and EXIT PROGRAM (two words).

diwz
Member
Posts: 44
Joined: Sun Feb 10, 2013 10:39 am

Post by diwz » Fri Feb 22, 2013 1:10 pm

Thanks. I got it from manual.

A STOP RUN statement returns control to the caller of the program at the nearest control boundary. If this is a hard control boundary, the activation group (run unit) will end, and all files scoped to the activation group will be closed.
A GOBACK statement issued from a main program (which is always at a hard control boundary) behaves the same as the STOP RUN statement. A GOBACK statement issued from a subprogram behaves the same as the EXIT PROGRAM statement. It does not change the status of any of the files in a run unit unless the ILE COBOL program issuing the GOBACK has the INITIAL attribute. If it has the INITIAL attribute, then all internal files defined in that program are closed.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Jul 18, 2013 12:58 am

Another way to look at is that GOBACK goes back to whatever invoked the code.

STOP RUN does just that - stops the run.

None of the sites i support allows STOP RUN in COBOL any more.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others