Chapter 2. Decremental Features

This chapter describes Fortran features that have been deleted or declared obsolescent in the current (Fortran 95) standard. The CF90 and MIPSpro 7 Fortran 90 compilers continue to support these features as extensions to the standard. The CF90 and MIPSpro 7 Fortran 90 compilers can generate messages when the deleted or obsolescent features are detected; to enable these messages, specify one of the following on the f90(1) command line: -ansi and -fullwarn (on IRIX systems) or -e n (on UNICOS or UNICOS/mk systems). For more information on these options, see the f90(1) man page.

Deleted Features

This section describes features that the Fortran 95 standard declares to be deleted from the Fortran language. These features had been included in previous revisions of the Fortran standard. The CF90 and MIPSpro 7 Fortran 90 compilers include these features as extensions. The deleted features are as follows:

PAUSE Statement

Execution of a PAUSE statement requires operator or system-specific intervention to resume execution. In most cases, the same functionality can be achieved as effectively and in a more portable way with the use of an appropriate READ statement that awaits some input data.

The execution of the PAUSE statement suspends the execution of a program. This is now redundant, because a WRITE statement can be used to send a message to any device, and a READ statement can be used to wait for and receive a message from the same device.

The PAUSE statement is defined as follows:

EXT

pause_stmt

is

PAUSE [stop_code]

The character constant or list of digits identifying the PAUSE statement is called the stop_code because it follows the same rules as those for the STOP statement's stop code. The stop code is accessible following program suspension. The CF90 and MIPSpro 7 Fortran 90 compilers send the stop_code to the standard error file (stderr). The following are examples of PAUSE statements:

PAUSE
PAUSE 'Wait #823'
PAUSE 100

ASSIGN, Assigned GO TO Statements, and Assigned Format Specifiers

The ASSIGN statement assigns a statement label to an integer variable. During program execution, the variable can be assigned labels of branch target statements, providing a dynamic branching capability in a program. The unsatisfactory property of these statements is that the integer variable name can be used to hold both a label and an ordinary integer value, leading to errors that can be hard to discover and programs that can be difficult to read.

A frequent use of the ASSIGN statement and assigned GO TO statement is to simulate internal procedures, using the ASSIGN statement to record the return point after a reusable block of code has completed. The internal procedure mechanism of Fortran now provides this capability.

A second use of the ASSIGN statement is to simulate dynamic format specifications by assigning labels corresponding to different format statements to an integer variable and using this variable in I/O statements as a format specifier. This use can be accomplished in a clearer way by using character strings as format specifications. Thus, it is no longer necessary to use either the ASSIGN statement or the assigned GO TO statement.

Execution of an ASSIGN statement causes the variable in the statement to become defined with a statement label value.

When a numeric storage unit becomes defined, all associated numeric storage units of the same type become defined. Variables associated with the variable in an ASSIGN statement, however, become undefined as integers when the ASSIGN statement is executed. When an entity of double-precision real type becomes defined, all totally associated entities of double-precision real type become defined.

Execution of an ASSIGN statement causes the variable in the statement to become undefined as an integer. Variables that are associated with the variable also become undefined.

Form of the ASSIGN and Assigned GO TO Statements

Execution of an ASSIGN statement assigns a label to an integer variable. Subsequently, this value can be used by an assigned GO TO statement or by an I/O statement to reference a FORMAT statement. The ASSIGN statement is defined as follows:

EXT

assign_stmt

is

ASSIGN label TO scalar_int_variable

The term default integer type in this section means that the integer variable must occupy a full word in order to be able to hold the address of the statement label. On CRAY T3E systems, programs that contain an ASSIGN statement and are compiled with -i 32 or -s default32 must ensure that the scalar_int_variable is declared as INTEGER(KIND=8). This ensures that it occupies a full word.

The variable must be a named variable of default integer type. It must not be an array element, an integer component of a structure, or an object of nondefault integer type.

The label must be the label of a branch target statement or the label of a FORMAT statement in the same scoping unit as the ASSIGN statement.

When defined with an integer value, the integer variable cannot be used as a label.

When assigned a label, the integer variable cannot be used as anything other than a label.

When the integer variable is used in an assigned GO TO statement, it must be assigned a label.

As the following example shows, the variable can be redefined during program execution with either another label or an integer value:

ASSIGN 100 TO K

Execution of the assigned GO TO statement causes a transfer of control to the branch target statement with the label that had previously been assigned to the integer variable.

The assigned GO TO statement is defined as follows:

EXT

assigned_goto_stmt

is

GO TO scalar_int_variable[[ , ] (label_list) ]

The variable must be a named variable of default integer type. That is, it must not be an array element, a component of a structure, or an object of nondefault integer type.

The variable must be assigned the label of a branch target statement in the same scoping unit as the assigned GO TO statement.

If a label list appears, such as in the following examples, the variable must have been assigned a label value that is in the list:

GO TO K
GO TO K (10, 20, 100)

The ASSIGN statement also allows the label of a FORMAT statement to be dynamically assigned to an integer variable, which can later be used as a format specifier in READ, WRITE, or PRINT statements. This hinders readability, permits inconsistent usage of the integer variable, and can be an obscure source of error.

This functionality is available through character variables, arrays, and constants.

Assigned Format Specifiers

When an I/O statement containing the integer variable as a format specifier is executed, the integer variable can be defined with the label of a FORMAT specifier.

H Edit Descriptor

This edit descriptor can be a source of error because the number of characters following the descriptor can be miscounted easily. The same functionality is available using the character constant edit descriptor, for which no count is required.

The following information pertains to the H edit descriptor:

Table 2-1. Summary of string edit descriptors

Descriptor

Description

H

Transfer of text character to output record

'text'

Transfer of a character literal constant to output record

"text"

Transfer of a character literal constant to output record

For more information on edit descriptors, see the Fortran Language Reference Manual, Volume 2.

Obsolescent Features

The obsolescent features are those features of previous Fortran standards that are considered by the Fortran 95 standard to be redundant. The Fortran 95 standard states that these features are obsolescent and provides preferred alternatives.

The obsolescent features and their preferred alternatives are as follows:

  • Arithmetic IF. The preferred alternative is the IF statement or IF construct. For more information on the arithmetic IF, see the Fortran Language Reference Manual, Volume 1.

  • Shared DO termination and termination on a statement other than END DO or CONTINUE statements. The preferred alternative is an END DO or a CONTINUE statement for each DO statement. For more information on this DO termination, see the Fortran Language Reference Manual, Volume 1.

  • Alternate return. An alternate return introduces labels into an argument list to allow the called procedure to direct the execution of the caller upon return. The preferred alternative is to use a return code that is used in a CASE construct on return. This avoids an irregularity in the syntax and semantics of argument association. Consider the following statement:

    CALL SUBR_NAME (X, Y, Z, *100, *200, *300)

    The preceding statement can be replaced by the following code:

    CALL SUBR_NAME (X, Y, Z, RETURN_CODE)
    SELECT CASE (RETURN_CODE)
       CASE (1)
          ...
       CASE (2)
          ...
       CASE (3)
          ...
       CASE DEFAULT
          ...
    END SELECT

    For more information on alternate returns, see Fortran Language Reference Manual, Volume 2.

  • Computed GO TO statement. The preferred alternative is the CASE construct, which is a generalized, easier to use, and more efficient means of expressing the same computation. For more information on the computed GO TO statement, see the Fortran Language Reference Manual, Volume 1.

  • Statement functions. These are subject to a number of nonintuitive restrictions and are a potential source of error because their syntax is easily confused with that of an assignment statement. The preferred alternative is the internal function, which is a more generalized form of the statement function that competely superseded the statement function construct. For more information on statement functions, see the Fortran Language Reference Manual, Volume 1.

  • DATA statements among executables. The statement ordering rules of previous Fortran standards allowed DATA statements to appear anywhere in a program unit after the specification statements. The ability to position DATA statements amongst executable statements is rarely used and is a potential source of error. For more information on the DATA statement, see the Fortran Language Reference Manual, Volume 1.

  • Assumed character length functions. Assumed character length for functions is an irregularity in the language because the typical Fortran philosophy is that the attributes of a function result depend only on the actual arguments of the invocation and on any data accessible by the function through host or USE association. Some uses of this facility can be replaced with an automatic character length function in which the length of the function result is declared in a specification expression. Other uses can be replaced by the use of a subroutine with arguments that correspond to the function result and the function arguments.

    Note that dummy arguments of a function can be assumed character length. For more information on assumed character length functions, see the Fortran Language Reference Manual, Volume 2.

  • Fixed source form. Fixed source form was designed when the principal machine-readable input medium for new programs was punched cards. Now that new and amended programs are typically entered at a keyboard with a screen display terminal, it is unnecessary overhead and is potentially error-prone to have to locate positions 6, 7, or 72 on a line. Free form source was designed expressly for this more modern technology. It is a simple matter to convert from fixed form to free form. For more information on fixed source form, see the Fortran Language Reference Manual, Volume 1.

  • CHARACTER* form of CHARACTER declaration. The CHARACTER*length form of specifying character declarations is redundant. For more information on the CHARACTER* form, see the Fortran Language Reference Manual, Volume 1.