1.3.2 Statements

Program statements are grouped into two general classes: executable and nonexecutable. An executable statement specifies an action to be performed. A nonexecutable statement describes program attributes, such as the arrangement and characteristics of data, as well as editing and data-conversion information.

A statement is divided into physical sections called lines. A line contains up to 72 characters (with a compiler option, 132). If a statement is too long to fit on one line, it can continue on one or more additional lines called continuation lines. A continuation line has a continuation character in the sixth column of the line.

A statement label identifies a statement so that other statements can refer to it, either to get information or to transfer control. A statement label must be one to five digits long, at least one of the digits must be nonzero, and it must appear in the first five columns of a statement's initial line. Any statement can have a label. However, you can only refer to labels of executable statements and FORMAT statements.

Order of Statements in a Program Unit

Figure 1-1 shows the required order of statements in a Fortran program unit. In this figure, vertical lines separate statement types that can be interspersed. For example, you can intersperse DATA statements with executable statements.

Horizontal lines indicate statement types that cannot be interspersed. For example, you cannot intersperse statements in the category "Other Specification Statements" (such as type declaration statements) with "Executable Statements".

Figure 1-1 Required Order of Statements and Lines

General Directives

Some of the general directives included in the category of "Comment Lines, INCLUDE Statements and General Directives" in Figure 1-1 apply to all platforms, but some are platform-specific.

The following general directives apply to all platforms:

cDEC$ ALIAS  cDEC$ SUBTITLE 
cDEC$ IDENT  cDEC$ TITLE 
cDEC$ PSECT   

The following general directives are platform-specific:

Directive  Platform 
cDEC$ ASSERT  VAX only 
cDEC$ INIT_DEP_FWD  VAX only 
cDEC$ NOVECTOR  VAX only 
cDEC$ OPTIONS  Alpha only 

Executable Statements

Many of the statements included in the category of "Executable Statements" in Figure 1-1 apply to all platforms, but the executable directives and some of the statements are platform-specific.

The following executable statements apply to all platforms:

ACCEPT  IF[2] and END IF 
ASSIGN  INQUIRE 
Assignment statements  OPEN 
BACKSPACE  PAUSE 
CALL  PRINT 
CLOSE  READ 
CONTINUE  RETURN 
DELETE  REWIND 
DO and END DO  REWRITE 
ELSE  STOP 
END  TYPE 
ENDFILE  WRITE 
FIND  UNLOCK 
GO TO[1]   

[1] Normal, computed, and assigned
[2] Arithmetic, logical, and block

The following executable directives and statements are platform-specific:

Statement or Directive  Platform 
cPAR$ DO_ PARALLEL  VAX only 
cPAR$ LOCKOFF  VAX only 
cPAR$ LOCKON  VAX only 
CASE  Alpha only 
CASE DEFAULT  Alpha only 
CYCLE  Alpha only 
EXIT  Alpha only 
SELECT CASE  Alpha only 
END SELECT  Alpha only 

Specification Statements

Many of the statements included in the category of "Other Specification Statements" in Figure 1-1 apply to all platforms, but the specification directives and some of the statements are platform-specific.

The following specification statements apply to all platforms:

AUTOMATIC  RECORD 
COMMON  SAVE 
DIMENSION  STATIC 
EQUIVALENCE  Structure declarations[1] 
EXTERNAL  Type declarations 
INTRINSIC  VOLATILE 
POINTER   

[1] Structure declarations include STRUCTURE and END STRUCTURE, UNION and END UNION, and MAP and END MAP.

The following specification directives and statements are platform-specific:
Statement or Directive  Platform 
cPAR$ CONTEXT_SHARED  VAX only 
cPAR$ CONTEXT_SHARED_ALL  VAX only 
cPAR$ PRIVATE  VAX only 
cPAR$ PRIVATE_ALL  VAX only 
cPAR$ SHARED  VAX only 
cPAR$ SHARED_ALL  VAX only 
DICTIONARY  VMS only 

As an extension, DATA statements can be freely interspersed with PARAMETER statements and other specification statements.

For More Information:


Previous Page Next Page Table of Contents