VMS Help  —  FORTRAN  Data  Variables
  A variable is a data object whose value can be changed at any point
  in a program.  It can be any of the following:

   o  A scalar name

      A scalar is a single object that has a single value; it can be
      of any intrinsic or user-defined type.

   o  An array name

      An array is a collection of scalar elements of any intrinsic or
      derived type.  All elements must be have the same type and kind
      type parameter.

   o  A subobject designator

      A subobject is part of an object.  The following are
      subobjects:

        An array element
        An array section
        A structure component
        A substring

      For example, B(3) is a subobject (array element) designator for
      array B.  A subobject cannot be a variable if its parent object
      is a constant.

  The name of a variable is associated with a single storage
  location.

  Variables are classified by data type, as constants are.  The data
  type of a variable indicates the type of data it contains,
  including its precision, and implies its storage requirements.
  When data of any type is assigned to a variable, it is converted to
  the data type of the variable (if necessary).

  A variable is usually defined in a type declaration statement or
  DATA statement.  But during program execution, events can occur to
  cause variables to be defined or redefined (such as assignment
  statements and READ statements), or undefined (such as an I/O
  error).

  Scalar variables are assigned data types explicitly in type
  declaration statements or IMPLICIT statements, or they can have
  implicit data types.

1  –  Implicit Typing

  By default, all variables with names beginning with I, J, K, L, M,
  or N are assumed to be integer variables.  Variables beginning with
  any other letter are assumed to be real variables.

  Names beginning with a dollar sign ($) are implicitly INTEGER.

  You can override the default data type implied in a name by
  specifying data type explicitly in either an IMPLICIT statement or
  a type declaration statement.

  Note:  You cannot change the implicit type of a name beginning with
  a dollar sign in an IMPLICIT statement.

2  –  Explicit Typing

  Type declaration statements explicitly specify the data type of
  scalar variables.  For example, the following statements associate
  VAR1 with an 8-byte complex storage location, and VAR2 with an
  8-byte double-precision storage location:

    COMPLEX VAR1
    DOUBLE PRECISION VAR2

  You can explicitly specify the data type of a scalar variable only
  once.

  An explicit data type specification takes precedence over the type
  specified by an IMPLICIT statement.  If no explicit data type
  specification appears, any variable with a name that begins with
  the letter in the range specified in the IMPLICIT statement becomes
  the data type of the variable.

  Character type declaration statements specify that given variables
  represent character values with the length specified.  For example,
  the following statements associate the variable names INLINE, NAME,
  and NUMBER with storage locations containing character data of
  lengths 72, 12, and 9, respectively:

    CHARACTER*72 INLINE
    CHARACTER NAME*12, NUMBER*9

  In single subprograms, assumed-length character arguments can be
  used to process character strings with different lengths.  The
  assumed-length character argument has its length specified with an
  asterisk, for example:

    CHARACTER*(*) CHARDUMMY

  The argument CHARDUMMY assumes the length of the actual argument.
Close Help