VMS Help
FORTRAN, Statements, INCLUDE

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  Directs the compiler to stop reading statements from the current
  file and read the statements in the included file or module.  When
  it reaches the end of the included file or module, the compiler
  resumes compilation with the next statement after the INCLUDE
  statement.  Statement format:

     INCLUDE 'full-file-name[/[NO]LIST]'

     INCLUDE '[text-lib] (module-name)[/[NO]LIST]'

     full-file-name  Is a character string that specifies
                     the file to be included.  The form of
                     the "full-file-name" must be acceptable
                     to the operating system, as described
                     in your user manual.

     /[NO]LIST    Specifies whether the incorporated code
                  is to appear in the compilation source
                  listing.  In the listing, a number precedes
                  each incorporated statement.  The number
                  indicates the "include" nesting depth of
                  the code. The default is /NOLIST.  /LIST
                  and /NOLIST must be spelled completely.

     text-lib     Is a character string that specifies
                  the "full-file-name" of the text
                  library to be searched.  Its form must
                  be acceptable to the operating system,
                  as described in your user manual.  If
                  "text-lib" is omitted, the specified
                  "module-name" must reside in the default
                  Fortran text library SYS$LIBRARY:FORSYSDEF.TLB,
                  or a user-specified default library.

     module-name  Is the name of the text module, located
                  in a text library, that is to be included.
                  The name of the module must be enclosed
                  in parentheses.  It can be up to 31 char-
                  acters long and can contain any alpha-
                  numeric character and the special char-
                  acters dollar sign ($) and underscore (_).

  The file or module must contain valid Fortran statements.  The file
  or module cannot start with a continuation line, but it can contain
  an INCLUDE statement.

  The limit on nesting depth is 10.

  In the following example, the file COMMON.FOR defines a parameter
  constant M, and defines arrays X and Y as part of the blank common
  block.

     Main Program File              COMMON.FOR File
     -----------------              ---------------
     INCLUDE 'COMMON.FOR'           PARAMETER (M=100)
     DIMENSION Z(M)                 COMMON X(M),Y(M)
     CALL CUBE
     DO 5, I=1,M

  5  Z(I) = X(I)+SQRT(Y(I))
         .
         .
         .
     END

     SUBROUTINE CUBE
     INCLUDE 'COMMON.FOR'
     DO 10, I=1,M
  10 X(I) = Y(I)**3
     RETURN
     END
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.