cobol

GOBACK statement

Remarks#

The COBOL GOBACK statement is a return. Unlike EXIT PROGRAM, or STOP RUN, GOBACK always returns one level. If the current module is “main”, GOBACK will return to the operating system. If the current module is a subprogram, GOBACK will return to the statement after a call.

GOBACK statement syntax diagram

GOBACK

identification division.
program-id. subprog.
procedure division.
display "in subprog"
goback.

...

call "subprog"
goback.

The first GOBACK above will return from subprog. Assuming the second is inside the main procedure, GOBACK will return to the operating system.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow