0 6.2.3 ALTER Statement
Ÿ Copyright IBM Corp. 1991, 1998
0
The ALTER statement changes the transfer point specified in a GO TO
statement.
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.
³------------------------------------------------------------------------³
³ ³
³ >>--ALTER------------------------------------------------------------> ³
³ ³
³ <--------------------------------------------------------³ ³
³ >----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 name a Procedure Division paragraph that contains only one
sentence: a GO TO statement without the DEPENDING ON phrase.
procedure-name-2
Must name a Procedure Division section or paragraph.
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.
The ALTER statement acts as a program switch, allowing, for example, one
sequence of execution during initialization and another sequence during
the bulk of file processing.
Altered GO TO statements in programs with the INITIAL attribute are
returned to their initial states each time the program is entered.
X Do not use the ALTER statement in programs that have the RECURSIVE
X attribute, in methods, or in AIX, OS/2, or Windows programs compiled with
X the THREAD option.