HP Fortran Programmer's Guide (September 2007)
Controlling data storage
Modules vs. common blocks
Chapter 3114
• The USE statement has an ONLY clause that specifies which module variables are
accessible to a particular program unit.
• The USE statement also has a renaming feature to resolve name clashes between local
variables and module variables.
Another feature of the module is that it can include procedures. This feature provides a way
to package data with the procedures needed to operate on the data. A program unit accesses
module procedures in the same way it does module data, with the USE statement. The
interface of module procedures is available to the compiler, which can perform compile-time
checks on the actual arguments that are passed to a module procedure.
Although the module does not completely replace the common block (see, for example,
“Sharing data among programs” on page 109), it does provide a safer and more flexible
alternative to the more common uses—and abuses—of the common block.
For an example of a program that uses the module to share data, see “Compiling programs
with modules” on page 82. The HP Fortran Programmer's Reference provides detailed
information about the module program unit and the MODULE and USE statements.