+-------------------------------IBM Extension--------------------------------+

AUTOMATIC

Purpose

The AUTOMATIC attribute specifies that a variable has a storage class of automatic; that is, the variable is not defined once the procedure ends.

Syntax



>>-AUTOMATIC--+----+--automatic_list---------------------------><
              '-::-'
 
 

automatic
is a variable name or an array declarator with an explicit-shape specification list or a deferred-shape specification list

Rules

If automatic is a function result it must not be of type character or of derived type.

Function results that are pointers or arrays, dummy arguments, statement functions, automatic objects, or pointees must not have the AUTOMATIC attribute. A variable with the AUTOMATIC attribute cannot be defined in the scoping unit of a module. A variable that is explicitly declared with the AUTOMATIC attribute cannot be a common block item.

A variable must not have the AUTOMATIC attribute specified more than once in the same scoping unit.

Any variable declared as AUTOMATIC within the scope of a thread's work will be local to that thread.

A variable with the AUTOMATIC attribute cannot be initialized by a DATA statement or a type declaration statement.

If automatic is a pointer, the AUTOMATIC attribute applies to the pointer itself, not to any target that is (or may become) associated with the pointer.

Note:
An object with the AUTOMATIC attribute should not be confused with an automatic object. See Automatic Objects.
Attributes Compatible with the AUTOMATIC Attribute





Examples

CALL SUB
CONTAINS
  SUBROUTINE SUB
    INTEGER, AUTOMATIC :: VAR
    VAR = 12
  END SUBROUTINE                  ! VAR becomes undefined
END

Related Information

+----------------------------End of IBM Extension----------------------------+

IBM Copyright 2003