SUBMODULE (Fortran 2008)

Purpose

The SUBMODULE statement is the first statement of a submodule program unit.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SUBMODULE-- (--parent_identifier--) -submodule_name---------><

parent_identifier

Read syntax diagramSkip visual syntax diagram
>>-ancestor_module_name--+--------------------------+----------><
                         '-:--parent_submodule_name-'   

submodule_name
Name of the submodule.
ancestor_module_name
Name of a nonintrinsic module.
parent_submodule_name
Name of a descendant submodule of the ancestor_module.

Rules

A submodule name cannot be accessed by use association; that is, it cannot be referred to by the USE statement.

A submodule cannot have the same name as any other program unit, external procedure, common block, or entity with a binding label in the program. In addition, the submodule name cannot be the same as any local name in the submodule. The name of a submodule can be the same as the name of another submodule if they do not have the same ancestor module.

If the END statement that completes the submodule specifies a submodule name, the name must be the same as the one that the SUBMODULE statement specifies.

Examples

MODULE mod
  ...
END MODULE

SUBMODULE (mod) mod1       ! parent_submodule_name is not specified
  ...
END SUBMODULE

SUBMODULE (mod) mod2       ! parent_submodule_name is not specified
  ...
END SUBMODULE

SUBMODULE (mod:mod1) mod3  ! parent_submodule_name is specified
  ...
END SUBMODULE


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us