Purpose
The MODULE statement is the first statement of a module program unit, which contains specifications and definitions that can be made accessible to other program units.
Format
>>-MODULE--module_name----------------------------------------->< |
Rules
The module name is a global entity that is referenced by the USE statement in other program units to access the public entities of the module. The module name must not have the same name as any other program unit, external procedure or common block in the program, nor can it be the same as any local name in the module.
If the END statement that completes the module specifies a module name, the name must be the same as that specified in the MODULE statement.
Examples
MODULE MM CONTAINS REAL FUNCTION SUM(CARG) COMPLEX CARG SUM_FNC(CARG) = IMAG(CARG) + REAL(CARG) SUM = SUM_FNC(CARG) RETURN ENTRY AVERAGE(CARG) AVERAGE = SUM_FNC(CARG) / 2.0 END FUNCTION SUM SUBROUTINE SHOW_SUM(SARG) COMPLEX SARG REAL SUM_TMP 10 FORMAT('SUM:',E10.3,' REAL:',E10.3,' IMAG',E10.3) SUM_TMP = SUM(CARG=SARG) WRITE(10,10) SUM_TMP, SARG END SUBROUTINE SHOW_SUM END MODULE MM
Related Information