IBM Books

Language Reference

ASSIGN

Purpose

The ASSIGN statement assigns a statement label to an integer variable.

Format



>>-ASSIGN--stmt_label--TO--variable_name-----------------------><
 

stmt_label
specifies the statement label of an executable statement or a FORMAT statement in the scoping unit containing the ASSIGN statement

variable_name
is the name of a scalar INTEGER(4) or INTEGER(8) variable

Rules

A statement containing the designated statement label must appear in the same scoping unit as the ASSIGN statement.

You can redefine an integer variable defined with a statement label value with the same or different statement label value or an integer value. However, you must define the variable with a statement label value before you reference it in an assigned GO TO statement or as a format identifier in an input/output statement.

The value of variable_name is not the integer constant represented by the label itself, and you cannot use it as such.

The ASSIGN statement has been deleted from Fortran 95.

Examples

      ASSIGN 30 TO LABEL
      NUM = 40
      GO TO LABEL
      NUM = 50                ! This statement is not executed
30    ASSIGN 1000 TO IFMT
      PRINT IFMT, NUM         ! IFMT is the format specifier
1000  FORMAT(1X,I4)
      END

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ] © Copyright IBM Corporation 1990, 1998