FORTRAN Reference Manual

Memory Organization
FORTRAN Reference Manual528615-001
12-9
Storage of Entities in Common Blocks
allocated by the system if sufficient space is not available or if the program
specifies a level-3 buffer area with a valid address in a call to
FORTRANSPOOLSTART. The program can run correctly, though slower, without a
level-3 spooling buffer area.
User-written TAL subprograms can also call GET^BUFFER and PUT^BUFFER to
make further use of these areas. This means that, with the default #LOWBUFFER size
of 609 words:
A FORTRAN program running as a NonStop process can have up to three EDIT
format files open at a time, because 3 * 169 = 507.
A FORTRAN program that is not running as a NonStop process or has no EDIT
format files open can have one output file open with automatic level-3 spooling,
because each level-3 buffer is 512 words.
Storage Areas With ENV COMMON
If ENV COMMON is in effect, FORTRAN allocates three special data blocks named
#CRE_GLOBALS, #CRE_HEAP, and #MCB. #CRE_GLOBALS and #MCB contain
run-time information for programs that specify the common environment. The runtime
environment uses space from #CRE_HEAP for file buffers and so forth. The default
size of #CRE_HEAP is 1,024 bytes, but you can specify its size with the HIGHBUFFER
compiler directive. You should not specify a value that is less than 1,024 for
HIGHBUFFER.
FORTRAN allocates a data block for each unit you define in your program. Each data
block holds one file control block. The names of these data blocks are of the form
##FTnnn where nnn is the unit number.
If you specify a RECEIVE directive, FORTRAN allocates a data block called
#RECEIVE.
If you specify HIGHCONTROL, FORTRAN allocates the #MCB data block and all file
control blocks in upper memory.
#CRE_HEAP is always in upper memory.
#CRE_GLOBALS and #RECEIVE are always in low memory.
FORTRAN does not allocate #LOWBUF in the common environment.
Storage of Entities in Common Blocks
When a program unit transfers control to a subprogram, it can also transfer data
through the subprogram’s arguments. Similarly, the called subprogram can return data
to its caller through its arguments. Function subprograms also return data as the value
of the function. These are the only means of exchanging data between subprograms
without using common blocks.
When a subprogram returns control to the calling program unit, its local data is lost
because local data is allocated on the stack. The COMMON statement enables you to