HP Fortran Programmer Guide HP-UX 11i v1, HP-UX 11i v2, and HP-UX 11i v3 (B3908-90032,December 2012)
In addition, the module provides the following controls on access to module data:
• The PUBLICand PRIVATEstatements declare which module variables are accessible outside
the module and which are not.
• The USE statement has an ONLYclause that specifies which module variables are accessible
to a particular program unit.
• The USEstatement 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 USEstatement. 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 113), 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 83. The HP Fortran Programmer's Referenceprovides detailed information about
the module program unit and the MODULEand USEstatements.
Modules vs. common blocks 73