Conditional GO TO
The conditional GO TO statement transfers control to one of a series of procedures, depending on the value of the data item referenced by the identifier.
GO TO Statement - Format 2 - Conditional .------------------. V | >>-GO--+----+----procedure-name-1-+-----------------------------> '-TO-' >--DEPENDING--+----+--identifier------------------------------->< '-ON-'
- procedure-name-1
- Must be a section or paragraph in the Procedure Division.
- identifier
- Must be a numeric elementary data item which is an integer.
IBM Extension
IBM Extension Cannot be a floating-point data item. End of IBM Extension
End of IBM ExtensionIf 1, control is transferred to the first statement in the procedure named by the first occurrence of procedure-name-1;
If 2, control is transferred to the first statement in the procedure named by the second occurrence of procedure-name-1, and so forth.
If the value of identifier is anything other than a value within the range of 1 through n (where n is the number of procedure-names specified in this GO TO statement), no control transfer occurs. Instead, control passes to the next statement in the normal sequence of execution.
