GOBACK Statement

The GOBACK statement exits the current program regardless of whether or not it is a called program.

General Format

GOBACK { [ {RETURNING} return-value] }
           {GIVING   }

Syntax Rules

  1. If a GOBACK statement is in a consecutive sequence of imperative statements in a sentence, it must be the last statement in that sentence.
  2. return-value must be a numeric literal or data item.

General Rules

  1. The GOBACK statement is equivalent to the statement sequence
    EXIT PROGRAM; STOP RUN
    This causes the current program to return to the caller if it is a called program or causes the run unit to halt if the program is not a called program.
  2. If return-value is specified, then it is assigned to the special register RETURN-CODE before the program is exited. This special register is defined as:
    77  RETURN-CODE  SIGNED-LONG, EXTERNAL.

    It is implicitly shared by all programs of a run unit and is automatically created by the compiler. The final value of RETURN-CODE is returned to the host operating system when the run unit completes. The compiler also creates an unsigned version of the return code called RETURN-UNSIGNED. It has the following implied definition:

    77 RETURN-UNSIGNED
          REDEFINES RETURN-CODE UNSIGNED-LONG, EXTERNAL.