FORTRAN 77 Language Reference

LOGICAL

The LOGICAL statement specifies the type to be logical for a symbolic constant, variable, array, function, or dummy function.

Optionally, it specifies array dimensions and initializes with values.

LOGICAL [*len[,]] v[*len[/c/]] [, v[*len[/c/]] ...

Parameter 

Description 

v

Name of a symbolic constant, variable, array, array declarator, function, or dummy function  

len

Either 1, 2, 4, or 8, the length in bytes of the symbolic constant, variable, array element, or function. 8 is allowed only if -dbl is on. @

c

List of constants for the immediately preceding name  

Description

The declarations can be: LOGICAL, LOGICAL*1, LOGICAL*2, LOGICAL*4, LOGICAL*8.

LOGICAL

For a declaration such as LOGICAL H, the variable H is usually one INTEGER*4 element in memory, interpreted as a single logical value. Specifying the size is nonstandard. @

If you do not specify the size, a default size is used. The default size, for a declaration such as LOGICAL Z, can be altered by compiling with any of the options -dbl, -i2,-r8, or -xtypemap. See the discussion in Chapter 2 for details.

LOGICAL*1 @

For a declaration such as LOGICAL*1 H, the variable H is always an BYTE element in memory, interpreted as a single logical value.

LOGICAL*2 @

For a declaration such as LOGICAL*2 H, the variable H is always an INTEGER*2 element in memory, interpreted as a single logical value.

LOGICAL*4 @

For a declaration such as LOGICAL*4 H, the variable H is always an INTEGER*4 element in memory, interpreted as a single logical value.

LOGICAL*8 @

For a declaration such as LOGICAL*8 H, the variable H is always an INTEGER*8 element in memory, interpreted as a single logical value.

Examples

Example 1: Each of these declarations are equivalent:


       LOGICAL U, V(9) 
       LOGICAL*4 U, V(9) 
       LOGICAL U*4, V(9)*4 

Example 2: Initialize:


       LOGICAL U /.false./, V /0/, W*4 /.true./, X*4 /'z'/