GO TO Statement

The GO TO statement provides for a direct transfer of control in the Procedure Division.

Format 1

GO TO procedure-name

Format 2

GO TO {procedure-name} ... DEPENDING ON depend-item

Syntax Rules

  1. procedure-name is the name of a paragraph or section in the program.
  2. depend-item is an integer elementary numeric data item.
  3. A Format 1 GO TO that is in a consecutive sequence of imperative statements in a sentence must be the last statement in that sentence.

Format 1 General Rules

The GO TO statement transfers control to procedure-name. No return mechanism is implied.

Format 2

  1. The GO TO DEPENDING statement transfers control to one of the procedure-names depending on the value of depend-item. A depend-item value of 1 refers to the first procedure-name, a value of 2 refers to the second, and so on.
  2. If depend-item is less than or equal to zero, or is greater than the number of procedure-names, no control transfer occurs. In this case, the GO TO statement has no effect.