HP 3000 Manuals

EXTERNAL Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

EXTERNAL Statement (Nonexecutable) 

The EXTERNAL statement identifies a name as representing a subprogram
name and permits the name to be used as an actual argument in subprogram
calls.

[]
----------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ----------------------------------------------------------------------------------------------- | | | | | procedure_name | Name of a subprogram. | Each name can appear once only in | | | | a given EXTERNAL statement, and in | | | | at most one EXTERNAL statement in | | | | a given program unit. | | | | | ----------------------------------------------------------------------------------------------- The EXTERNAL statement provides a means of using the names of subroutine subprograms and function subprograms as actual arguments. The EXTERNAL statement is necessary to inform the compiler that these names are subprograms or function names, not variable names. Whenever a subprogram name is passed as an actual argument, it must be placed in an EXTERNAL statement in the calling program. If an intrinsic function name appears in an EXTERNAL statement, the compiler assumes that a user subprogram by that name exists; the intrinsic function is not available to that program unit. A name cannot appear in both an EXTERNAL and INTRINSIC statement. Examples Notes -------------------------------------------------------------------------------------- PROGRAM my_sin This call is to the user-written function named EXTERNAL sin sin, not to the intrinsic function SIN. A statement REAL sin, x, y function name must not appear in an EXTERNAL READ(5,*) y statement. x = sin(y) WRITE(6,*) x END EXTERNAL b1 The EXTERNAL statement declares b1 to be a CALL sub(a,b1,c) subprogram name. The call to sub passes the values : of a and c, and passes the name of the subprogram END (b1). SUBROUTINE sub(x,y,z) The reference to y causes b1 to be called. z = y(z) RETURN END


MPE/iX 5.0 Documentation