VMS Help  —  FORTRAN  Statements  ALLOCATE
  Dynamically creates storage for allocatable arrays and pointer
  targets.  The storage space allocated is uninitialized.

  The ALLOCATE statement takes the following form:

    ALLOCATE (object [(s-spec[,s-spec...])]
              [,object[(s-spec[,s-spec...])]]...[,STAT=sv])

      object  Is the object to be allocated.  It is a variable
              name or structure component, and must be a pointer
              or allocatable array.  The object can be of type
              character with zero length.

      s-spec  Is a shape specification in the form
              [lower-bound:]upper-bound. Each bound must be a
              scalar integer expression. The number of shape
              specifications must be the same as the rank of
              the "object".

      sv      Is a scalar integer variable in which the status
              of the allocation is stored.

  A bound in "s-spec" must not be an expression containing an array
  inquiry function whose argument is any allocatable object in the
  same ALLOCATE statement; for example, the following is not
  permitted:

     INTEGER ERR
     INTEGER, ALLOCATABLE :: A(:), B(:)
     ...
     ALLOCATE(A(10:25), B(SIZE(A)), STAT=ERR)  ! A is invalid as an argu-
                                               !   ment to function SIZE

  If a STAT variable is specified, it must not be allocated in the
  ALLOCATE statement in which it appears.  If the allocation is
  successful, the variable is set to zero.  If the allocation is not
  successful, an error condition occurs, and the variable is set to a
  positive integer value (representing the run-time error).  If no
  STAT variable is specified and an error condition occurs, program
  execution terminates.

  To release the storage for an allocated array, use the DEALLOCATE
  statement.

  To determine whether an allocatable array is currently allocated,
  use the ALLOCATED intrinsic function.

  To determine whether a pointer is currently associated with a
  target, use the ASSOCIATED intrinsic function.

  For information on allocation of allocatable arrays and pointer
  targets, see the HP Fortran for OpenVMS Language Reference
  Manual.

  EXAMPLES:

  The following is an example of the ALLOCATE statement:

     INTEGER J, N, ALLOC_ERR
     REAL, ALLOCATABLE :: A(:), B(:,:)
     ...
     ALLOCATE(A(0:80), B(-3:J+1, N), STAT = ALLOC_ERR)
Close Help