Coding Example

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. Because altered GO TO statements are difficult to debug, it is preferable to test a switch, and based on the value of the switch, execute a particular code sequence. For example:
   PARAGRAPH-1.
     GO TO BYPASS-PARAGRAPH.
   PARAGRAPH-1A.
     .
     .
   BYPASS-PARAGRAPH.
     .
     .
    ALTER PARAGRAPH-1 TO PROCEED TO
        PARAGRAPH-2.
     .
     .
   PARAGRAPH-2.
     .
     .

Before the ALTER statement is executed, when control reaches PARAGRAPH-1, the GO TO statement transfers control to BYPASS-PARAGRAPH. After execution of the ALTER statement, however, the next time control reaches PARAGRAPH-1, the GO TO statement transfers control to PARAGRAPH-2.

Altered GO TO statements in programs with the INITIAL attribute are returned to their initial state each time the program is entered.