ALTER Statement

The ALTER statement changes the transfer point specified in a GO TO statement.
Note: The ALTER statement encourages the use of unstructured programming practices. The EVALUATE statement provides the same function as the ALTER statement and helps to ensure that your program will be well-structured.
Read syntax diagramSkip visual syntax diagram
ALTER Statement - Format

>>-ALTER-------------------------------------------------------->

   .--------------------------------------------------------.   
   V                                                        |   
>----procedure-name-1--TO--+------------+--procedure-name-2-+--><
                           '-PROCEED TO-'                       

The ALTER statement modifies the GO TO statement in the paragraph named by procedure-name-1. Subsequent executions of the modified GO TO statement(s) transfer control to procedure-name-2.
procedure-name-1
Must be a Procedure Division paragraph that contains only one sentence: a GO TO statement without the DEPENDING ON phrase.
procedure-name-2
Must be a Procedure Division section or paragraph.

If procedure-name-1 or procedure-name-2 are within a declarative procedure, neither can reference any nondeclarative procedure. In the nondeclarative portion of the program, there must be no reference to procedure-names that appear in an EXCEPTION/ERROR declarative procedure, except that PERFORM statements may refer to an EXCEPTION/ERROR procedure or procedures associated with it.

Before the ALTER statement is executed, when control reaches the paragraph specified in procedure-name-1, the GO TO statement transfers control to the paragraph specified in the GO TO statement. After execution of the ALTER statement, however, the next time control reaches the paragraph specified in procedure-name-1, the GO TO statement transfers control to the paragraph specified in procedure-name-2.

Note: Do not use the ALTER statement in programs that have the RECURSIVE attribute.
Related Information: