The verb in COBOL that does this is ALLOCATE
. Assignment of can only be used with a data item defined as BASED
(which indicates that the compiler does not assign the usual storage for the data item). FREE
release the unreached storage.
ALLOCATE / BASE / FREE have existed since the 2002 Standard which was replaced by the 2014 Standard. The implementation is down to the compiler vendor and not all compilers support this.
All Cobols will have additional ways to allocate storage assigned to a value of POINTER
through a system call of some kind.
There is also a way to load, but not run, "a program" that contains the storage (usually for reference), using a PROCEDURE- POINTER
(or a FUNCTION-POINTER
).
CALL
is used in many ways to do many things, including allowing access to storage outside the currently active program. If something doesn’t exist, you can always write a program and CALL it.
Hello and thank you for answering. Is there any sample code with all these commands? All these keywords? I have Stern & Stern but it seems to me he has nothing. Some Cobol books from the 80s are not a good choice. Is there a book that talks about this? I suppose internet examples are better. Thanks again.
– Listeiro 037
Find the Gnucobol project (currently on Sourceforge ) . There are some examples there . Searching with keywords should also locate them. I contribute to this project. , And there is an active discussion area. Search Gnucobol Programming Guide by Gary Cutler .
– Bill Woodger