LOGICAL Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
LOGICAL Statement (Nonexecutable)
The LOGICAL type specification statement explicitly assigns the
LOGICAL*1, LOGICAL*2, and LOGICAL*4 data types to symbolic names, and
optionally assigns initial values to variables.
The following syntax includes the LOGICAL, LOGICAL*1, LOGICAL*2, and
LOGICAL*4 statements. See also "BYTE Statement (Nonexecutable)" .
Semantics
The LOGICAL*1, LOGICAL*2, and LOGICAL*4 statements are extensions to the
ANSI 77 standard. LOGICAL*1 declares items to be 1-byte logicals,
LOGICAL*2 declares them to be 2-byte logicals, and LOGICAL*4 declares
them to be 4-byte logicals.
NOTE By default, the LOGICAL statement is equivalent to the LOGICAL*4
statement. This is the same as the effect of the LONG compiler
directive. The SHORT compiler directive may be used to make
LOGICAL equivalent to LOGICAL*2. See Chapter 7 for further
details. In addition, compiler run-string options can have the
same effect. See "Compiler Options" for further details.
If an array declarator is specified in a type statement, the declarator
for that array must not appear in any other specification statement (such
as DIMENSION). If only the array name is specified, an array declarator
must appear within a DIMENSION or COMMON statement.
As an extension to the ANSI 77 standard, the length specifier can follow
the item being declared. This specification overrides the length implied
by the type statement. If the item being declared is an array name with
a dimension declarator, the length specifier precedes the dimension
declarator.
Each symbolic name can appear in a type statement only once.
As an extension to the ANSI 77 standard, you can initialize variables or
arrays in a type declaration statement by enclosing the initialization
values between slashes. See "DATA Statement (Nonexecutable)" for
details about initialization.
Examples Notes
---------------------------------------------------------------------------------------
LOGICAL is_ok*2,error*4,bool is_ok is a 2-byte logical variable. error
and bool are both 4-byte logical variables.
LOGICAL ok*4/.TRUE./ ok is a 4-byte logical variable,
initialized to the value true.
LOGICAL*2 bool(10)/10*.FALSE./ bool is an array of 10 2-byte logical
elements, each initialized to the value
false.
MPE/iX 5.0 Documentation