FORTRAN Reference Manual
Converting Programs to HP FORTRAN
FORTRAN Reference Manual—528615-001
C-2
If you convert a program that uses a combination of CHARACTER and other data
types in the same common block, you can declare a RECORD in the common
block, and declare all the variables in the common block as components of the
RECORD. (HP FORTRAN allows mixing of CHARACTER and other data types
within a RECORD, since the entire RECORD feature is an HP extension.) If you do
this, you must also change all references to those variables so that they are
qualified by the RECORD name throughout all the executable statements of the
source program.
•
User and extended data segments
In most computer systems, there is only one data area and all data addresses are
the same length. NonStop systems have two data areas, the user data segment
and the extended data segment, in which objects have 16-bit and 32-bit addresses,
respectively. You should allocate smaller and more frequently used data objects in
the user data segment for efficient access. Place larger and less frequently used
objects in the extended data segment where more executable instructions are
required to manipulate 32-bit addresses.
If a FORTRAN program’s data objects do not all fit into the user data segment
(where HP FORTRAN places them by default), you can add the directive line
? LARGECOMMON, LARGEDATA
at the beginning of the source program file. When the LARGECOMMON and
LARGEDATA directives are in effect, the FORTRAN compiler allocates all
COMMON blocks and all local data items larger than 256 bytes in the extended
data segment.
This is likely to make the recompiled object program much larger and somewhat
slower, but it should at least run. Following the general principle “First make it run
correctly, and then make it work better,” you can determine which common blocks
and local data items should be in which data area, based on their size and
frequency of usage. Then modify the LARGECOMMON and LARGEDATA
directives so the program makes optimal use of each data area.
•
Allocation of local data objects
Most FORTRAN systems support only static allocation of local data objects. That
is, all variables and arrays are given run-time memory space when a program
begins execution, and remain allocated throughout execution of the program.
Because HP FORTRAN allows recursive procedure calls, local data objects are
normally allocated space on the run-time stack at the time their procedure is
entered, and their memory space is released when the procedure returns to its
caller. HP FORTRAN provides static allocation for all variables in common blocks
and for all local variables that are named in DATA statements or SAVE statements,
but it provides dynamic allocation for all other local variables to conserve run-time
memory space.










