An ASSOCIATE statement is the first statement in an ASSOCIATE construct. It establishes an association between each identifier and a variable, or the value of an expression.
.-,----------------------------. V | >>-+-----------------------------+--ASSOCIATE--(----associate_name--=>--selector-+--)->< '-associate_construct_name--:-'
If the selector is an expression or a variable with a vector subscript, the associate_name is assigned the value of the expression or variable. That associating entity must not become redefined or undefined.
If the selector is a variable without a vector subscript, the associate_name is associated with the data object specified by the selector. Whenever the value of the associate_name (or the associating entity identified by the associate_name) changes, the value of the variable changes with it.
If the selector has the ALLOCATABLE attribute, the associating entity does not have the ALLOCATABLE attribute. If the selector has the POINTER attribute, then the associating entity has the TARGET attribute. If the selector has the TARGET or VOLATILE attribute, the associating entity that is a variable has those attributes.
If the selector has the OPTIONAL attribute, it must be present.
An associating entity has the same type, type parameters, and rank as the selector. If the selector is an array, the associating entity is an array with a lower bound for each dimension equal to the value of the intrinsic LBOUND(selector). The upper bound for each dimension is equal to the lower bound plus the extents minus 1.
An associate_name must be unique within an ASSOCIATE construct.
If the associate_construct_name appears on an ASSOCIATE construct statement, it must also appear on the corresponding END ASSOCIATE statement.
An ASSOCIATE construct statement must not appear within the dynamic or lexical extent of a parallel region.
test_equiv: ASSOCIATE (a1 => 2, a2 => 40, a3 => 80) IF ((a1 * a2) .eq. a3) THEN PRINT *, "a3 = (a1 * a3)" END IF END ASSOCIATE test_equiv END