Actual arguments and their corresponding dummy arguments must agree in data type. If the actual argument is a Hollerith constant (for example, 4HABCD), the dummy argument must have a numeric data type.
If an actual argument is a character constant (for example,
'ABCD'
), the following rules apply to dummy arguments:
If the dummy argument has a numeric data type, the character
constant 'ABCD'
is, in effect, converted to a
Hollerith constant by the compiler and the linker
(only if the called routine is written in Fortran).
When the function or subroutine name is itself a dummy argument, it is not possible to determine at compile time or link time whether a character constant or Hollerith constant is required. In this case, a character constant actual argument can correspond only to a character dummy argument.
The following example shows character and
Hollerith constants being used as actual arguments. In this
example, the subroutine names CHARSUB and HOLLSUB are themselves
dummy arguments of the subroutine S. Therefore, the actual argument
'STRING'
in the call to CHARSUB must correspond to a
character dummy argument, whereas the actual
argument 6HSTRING in the call to HOLLSUB must correspond to a
numeric dummy argument.
SUBROUTINE S(CHARSUB,HOLLSUB,A,B) EXTERNAL CHARSUB,HOLLSUB . . . CALL CHARSUB(A,'STRING') CALL HOLLSU(B, 6HSTRING)