COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
• Compatible with malloc() function
The ALLOCATE statement is compatible with the C Run-Time Library function malloc() and
related functions. To release the memory, a non-NULL pointer returned by ALLOCATE can be
passed to a C-language routine that calls free().
• Dynamic memory cannot be checkpointed
Dynamic memory cannot be checkpointed to a backup process.
ALTER
NOTE: The 1985 COBOL standard classifies ALTER as obsolete, so you are advised not to use
it. Instead, use a flag, a conditional GO TO statement, and a MOVE statement.
ALTER changes the destination of a GO TO statement, which can cause maintenance problems.
paragraph-name
is the name of a paragraph that contains only an unconditional GO TO statement.
destination
is the name of a paragraph or section to which the GO TO statement in paragraph-name
transfers control.
Usage Considerations:
• Maintenance Problems
ALTER can cause maintenance problems because it enables a GO TO statement to transfer
control anywhere in the program. When you read the source code, the only clue you have
that the destination was altered is that the GO TO statement is alone in a paragraph.
• Using a Flag, Conditional GO TO, and MOVE Instead of ALTER
Suppose that you want to initialize a routine the first time it is called, but not each time it is
called. You could either use an ALTER statement as Example 77 does (not recommended) or
a flag, a conditional GO TO statement, and a MOVE statement as Example 78 does
(recommended and no less efficient).
ALTER 291










