Variables

A variable is a data object whose value can be changed at any point in a program. A variable can be any of the following:

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 defined when you give it a value. A variable can be defined before program execution by a DATA statement or a type declaration statement. During program execution, variables can be defined or redefined in assignment statements and input statements, or undefined (for example, if an I/O error occurs). When a variable is undefined, its value is unpredictable.

When a variable becomes undefined, all variables associated by storage association also become undefined.

An object with subobjects, such as an array, can only be defined when all of its subobjects are defined. Conversely, when at least one of its subobjects are undefined, the object itself, such as an array or derived type, is undefined.

Execution of an asynchronous READ statement causes all of the variables specified by the input item list or SIZE= specifier to become undefined. Execution of an asynchronous namelist READ statement causes any variable in the name list group to become undefined if that variable will subsequently be defined during the execution of the READ statement or any corresponding WAIT operation.

This section also discusses the Data Types of Scalar Variables and Arrays.

See Also