Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)

Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual426750-001
6-43
GO TO Statements
GO TO Statements
The GO TO statements pass control from one part of the Procedure Division to another.
The forms of the GO TO statements are:
GO TO
GO TO DEPENDING
Each form is described in the following paragraphs.
GO TO Statement
The GO TO statement unconditionally passes control from one part of the Procedure
Division to another.
procedure-name
is the name of the procedure to which control is transferred.
GO TO DEPENDING Statement
The GO TO DEPENDING statement passes control to one of several procedures
depending on a variable data item.
procedure-name
is a series of procedure names. Only one is chosen, based on the value of depend.
depend
is the identifier of an elementary numeric integer data item. This item acts like an
index because its value selects the procedure name to which the program branches.
If the value of depend is outside the range of procedure-name, no branching
occurs and control passes to the next statement.
The following example illustrates the GO TO DEPENDING statement:
procedure-branch.
GO TO proc-1,
proc-2,
proc-3, DEPENDING ON branch-flag.
MOVE 0 to branch-flag.
If branch-flag is 1, control passes to proc-1.
If branch-flag is 2, control passes to proc-2.
If branch-flag is 3, control passes to proc-3.
GO [ TO ] procedure-name
GO TO { procedure-name } ,... DEPENDING [ ON ] depend