HP Fortran Programmer's Reference (September 2007)

Program units and procedures
Modules
Chapter 7 191
is zero or more of the statements listed in Table 7-1 with the exception of the
FORMAT statement. Also,
specification-part
must not contain statement
function definitions or automatic objects. (Specifying the SAVE attribute
within a module is unnecessary in HP Fortran as entities declared within a
module retain their values by default.)
Each entity declared in
specification-part
and each of the procedure
defined in
module-procedure-part
has either the PUBLIC or PRIVATE
attribute. By default, all entities have the PUBLIC attribute and are thereby
accessible by use association. Entities having the PRIVATE attribute are
accessible from within the module only.
The PUBLIC and PRIVATE attributes and statements are fully described in
Chapter 10, “HP Fortran Statements.”
module-procedure-part
is:
CONTAINS
module-procedure
[
module-procedure
...]
module-procedure
is either a function or subroutine.
module-procedure
has the same
structure as an external function or subroutine except that the END
statement of
module-procedure
must include the SUBROUTINE or FUNCTION
keyword, as appropriate; for an external procedure this is optional. For
information about external subroutines, see “External procedures” on
page 161.
Note the following about module procedures:
They have an explicit interface within the using program unit. It is not
necessary to create an interface block for a module procedure.
They can also contain internal procedures.
They can be passed as an actual argument.
The following may be contained in a module and be made accessible by use association:
Declared variables
Named constants
Derived-type definitions
Procedure interfaces
Module procedures