GOBACK statement

Other topics

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.

Contributors

Topic Id: 7173

Example Ids: 23993

This site is not affiliated with any of the contributors.