Previous Topic Next topic Print topic


OSVSVSC2MF 

The GOBACK Statement

The GOBACK statement marks the logical end of a called program.

MF You can also return values to calling runtime elements written in any language or to the operating system environment.

General Format


The GOBACK Statement

Syntax Rules

  1. If a GOBACK statement appears in a consecutive sequence of imperative statements within a sentence, it must appear as the last statement in that sequence.

    This rule is not enforced, although any statements in the sentence that follow the GOBACK statement are not executed.

  2. MF GIVING and RETURNING are equivalent.
  3. MF  The data item referenced by identifier-1 must be no larger than 8 bytes in size.
  4. Integer-1 may be signed.

General Rules

  1. If a GOBACK statement is executed in a program which is under the control of a calling runtime element, the object program operates as if executing an EXIT PROGRAM statement that has the same clauses as the GOBACK statement. See the topic The EXIT Statement.
  2. If a GOBACK statement without the ADDRESS OF clause is executed in a program which is not under the control of a calling runtime element, the object program operates as if executing a STOP RUN statement that has the same clauses as the GOBACK statement.
  3. If a GOBACK statement with the ADDRESS OF clause is executed in a program which is not under the control of a calling runtime element, the object program operates as if executing a STOP RUN statement except that an arbitrary returned value is set in the system area. The GOBACK statement may result in more compact code than the equivalent EXIT PROGRAM and STOP RUN statement.
  4. A GOBACK statement must not be executed while executing a declarative procedure in which the GLOBAL phrase is specified except in a program called while executing that declarative procedure.
  5. ISO2002 If a GOBACK statement is executed in a function, the function operates as if executing an EXIT FUNCTION statement.
  6. ISO2002MF If a GOBACK statement is executed in a method, the method operates as if executing an EXIT METHOD statement.
  7. NETJVM If a GOBACK statement is executed in an iterator, the iterator operates as if executing an EXIT ITERATOR statement.
Previous Topic Next topic Print topic