The ALTER statement modifies a predetermined sequence of operations.
The ALTER statement is classed as an obsolete element in the ANSI'85 standard and is scheduled to be deleted from the next
full revision of the ANSI Standard.
All dialects in this COBOL implementation fully support this syntax. The FLAGSTD Compiler directive can be used to detect
all occurrences of this syntax.
Although it is a part of the standard COBOL definition, this verb is explicitly excluded from the X/Open COBOL language definitions
and should not be used in a conforming X/Open COBOL source program.
General Format
Syntax Rules
- Each procedure-name-1, procedure-name-3, ..., is the name of a paragraph that contains a single sentence consisting of a GO
TO statement without the DEPENDING phrase.
- Each procedure-name-2, procedure-name-4, ..., is the name of a paragraph or section in the Procedure Division.
- The ALTER statement is not supported in class programs when compiling to
.NET COBOL code.
General Rules
- Execution of the ALTER statement modifies the GO TO statement in the paragraph named procedure-name-1, procedure-name-3, ...,
so that subsequent executions of the modified GO TO statements cause transfer of control to procedure-name-2, procedure-name-4,
..., respectively. Modified GO TO statements in independent segments can, under some circumstances, be returned to their initial
states (see the section
Independent Segments in the topic
Segmentation.
- A GO TO statement in a section whose segment-number is greater than or equal to 50 must not be referred to by an ALTER statement
in a section with a different segment-number.
All other uses of the ALTER statement are valid and are performed even if procedure-name-1, procedure-name-3 is in an overlayable
fixed segment.