Lahey/Fujitsu Fortran

Internal Procedures

A procedure can contain other procedures, which can be referenced only from within the host procedure. Such procedures are known as internal procedures. An internal procedure is specified within the host procedure following a CONTAINS statement, which must appear after all the executable code of the containing subprogram. The form of an internal procedure is the same as that of an external procedure.

 
Example:
subroutine external () ... call internal () ! reference to internal procedure ... contains subroutine internal () ! only callable from external() ... end subroutine internal end subroutine external

Names from the host procedure are accessible to the internal procedure. This is called host association.