In addition, the module provides the following controls on access to module data:

The PUBLIC and 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 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 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” (page 72)), 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” (page 54). The HP Fortran Programmer's Reference provides detailed information about the module program unit and the MODULEand USEstatements.

Modules vs. common blocks 75