HP 3000 Manuals

GOBACK Statement [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

GOBACK Statement 

The GOBACK statement is an HP extension to the ANSI COBOL standard.

The GOBACK statement marks the logical end of a program.

Syntax 

     GOBACK 

Description 

The GOBACK statement must be the only statement in a sentence.  If used
in a series of imperative statements, it must be the last statement in
the series.

If a GOBACK statement is encountered in a called program, control returns
to the statement in the calling program immediately following the CALL
statement that initiated the called program.  Thus, in a subprogram, the
GOBACK statement acts in the same way as an EXIT PROGRAM statement.

If a GOBACK statement is used in a main program, it is equivalent to a
STOP RUN statement.  Thus, it indicates the logical end of the run unit,
and control is passed to the operating system.

Table 11-2  shows the relationship between the EXIT PROGRAM, STOP RUN,
and GOBACK statements. 

          Table 11-2.  Relationship Between EXIT PROGRAM, STOP RUN and GOBACK Statements 
---------------------------------------------------------------------------------
|                       |                           |                           |
|      Termination      |    In a Main Program:     |     In a Subprogram:      |
|      Statements       |                           |                           |
|                       |                           |                           |
---------------------------------------------------------------------------------
|                       |                           |                           |
| EXIT PROGRAM          | Non-operational.  Treated | Returns to calling        |
|                       | as EXIT.                  | program.                  |
|                       |                           |                           |
---------------------------------------------------------------------------------
|                       |                           |                           |
| STOP RUN              | Logical end of run.       | Logical end of run for    |
|                       | Returns control to        | both the subprogram and   |
|                       | operating system.         | the calling program.      |
|                       |                           | Returns control to        |
|                       |                           | operating system.         |
|                       |                           |                           |
---------------------------------------------------------------------------------
|                       |                           |                           |
| GOBACK                | Logical end of run.       | Returns to calling        |
|                       | Returns control to        | program.                  |
|                       | operating system.         |                           |
|                       |                           |                           |
---------------------------------------------------------------------------------



MPE/iX 5.0 Documentation