The following example demonstrates a main program which calls one intrinsic function, (FLOOR), one internal procedure, (Negative) and one external procedure (TenTimes).
PROGRAM Main
IMPLICIT NONE
REAL x
INTRINSIC FLOOR
REAL, EXTERNAL :: TenTimes
READ*, x
PRINT*, FLOOR(x)
PRINT*, Negative(x)
PRINT*, TenTimes(x)
CONTAINS
REAL FUNCTION Negative(a)
REAL, INTENT(IN) :: a
Negative = -a
END FUNCTION Negative
END PROGRAM Main
REAL FUNCTION TenTimes(a)
IMPLICIT NONE
REAL, INTENT(IN) :: a
TenTimes = 10.0*a
END FUNCTION TenTimes
Although not totally necessary, the intrinsic procedure is declared in an INTRINSIC statement (the type is not needed -- the compiler knows the types of all intrinsic functions).
The external procedure is a function so we must specify its type in the main program, it is also given the EXTERNAL attribute which is not essential but makes matters clearer.
The internal procedure is `contained within' the main program so does not require declaring in the main program.