HP Fortran Programmer's Reference (September 2007)

Program units and procedures
Modules
Chapter 7190
Modules
A module is a nonexecutable program unit that contains—usually related—definitions and
declarations that may be accessed by use association. Typically, modules are used for:
Defining and declaring derived types
Defining and declaring global data areas
Defining operators
Creating subprogram libraries
The definitions within a module are made accessible to other program units through use
association. The program unit that requires access to the module must have a USE statement
at the head of its specification part, and the statement must specify the name of the module.
The following sections describe the module program unit and the USE statement. The last
section gives an example program that uses a module.
NOTE Compiling programs that contain modules requires care to ensure that each
module is compiled before the program unit that uses it. For detailed
information about compiling programs that contain modules, refer to the
HP Fortran Programmer’s Guide.
Module program unit
The syntax of a module program unit is:
MODULE
module-name
[
specification-part
]
[
module-procedure-part
]
END [MODULE [
module-name
]]
where:
module-name
is the name of the module.
specification-part