COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Example 76 ADD CORRESPONDING Statement
WORKING-STORAGE SECTION.
01 CABINET-SUPPLIES.
05 PAPER-CLIPS PIC 99.
05 WRITING-TOOLS.
10 PENCILS PIC 99.
10 PENS PIC 99.
10 ERASERS PIC 99.
10 PAPER PIC 99.
05 STAPLES PIC 99.
01 STOCKROOM-SUPPLIES.
05 WRITING-TOOLS.
10 PENCILS PIC 99.
10 ERASERS PIC 99.
10 PENS PIC 99.
05 PAPER-CLIPS PIC 99.
05 PAPER PIC 99.
...
PROCEDURE DIVISION.
...
ADD CORRESPONDING CABINET-SUPPLIES TO STOCKROOM-SUPPLIES.
ALLOCATE
DescriptionForm
Obtains a specified number of bytes of dynamic memoryALLOCATE bytes
Obtains dynamic memory for a BASED itemALLOCATE BASED item
ALLOCATE Bytes
ALLOCATE bytes obtains dynamic memory for a specified number of bytes.
arith-expr
is an arithmetic expression specifying the number of bytes of memory to obtain. If arith-expr
does not evaluate to an integer, the result is rounded up to the next whole number. If
arith-expr evaluates to zero or a negative value, no memory is obtained and the value
NULL is assigned to pointer.
pointer
is a data item described as USAGE POINTER. pointer is set to the address of the allocated
memory, or to NULL if arith-expr evaluates to zero or a negative value.
Usage Considerations:
• Use only when the STANDARD 2002 directive is in effect.
• Requested memory not available
If the requested amount of memory is not available, pointer is set to NULL, and execution
continues.
• INITIALIZED specified
If the optional INITIALIZED phrase is specified, the allocated memory is initialized to binary
zeros. If INITIALIZED is omitted, the content of the allocated memory is undefined.
ALLOCATE 289










