SuivantPrec.Bas prec.BasNiv. sup.

4.4 Statement Types and Order 

Fortran statements are either executable or non-executable. The compiler translates executable statements directly into a set of machine code instructions. Non-executable statements are mainly used to tell the compiler about the program; they are not directly translated into machine code. The END statement is executable and so are all those in the lowest right-hand box of the table below; all other statements are non-executable.

The general order of statements in a program unit is:

The table below shows the complete statement ordering rules: the statements listed in each box can be intermixed with those in boxes on the same horizontal level (thus PARAMETER statements can be intermixed with IMPLICIT statements) but those in boxes separated vertically must appear in the proper order in each program unit (thus all statement functions must precede all executable statements).
PROGRAM, FUNCTION, SUBROUTINE, BLOCK DATA
IMPLICIT
PARAMETERType statements:
INTEGER, REAL, DOUBLE PRECISION,
COMPLEX, LOGICAL, CHARACTER
Other specification statements:
COMMON, DIMENSION, EQUIVALENCE,
EXTERNAL, INTRINSIC, SAVE
FORMAT Statement function statements
DATA Executable statements:
BACKSPACE, CALL, CLOSE, CONTINUE, DO,
ELSE, ELSE IF, END IF, GO TO, IF,
INQUIRE, OPEN, READ, RETURN, REWIND,
STOP, WRITE, assignment statements.
END

Execution Sequence 

A program starts by executing the first executable statement of the main program unit. Execution continues sequentially unless control is transferred elsewhere: an IF or GO TO statement, for example, may transfer control to another part of the same program unit, whereas a CALL statement or function reference will transfer control temporarily to a procedure.

A program continues executing until it reaches a STOP statement in any program unit, or the END statement of the main program unit, or until a fatal error occurs. When a program terminates normally (at STOP or END) the Fortran system closes any files still open before returning control to the operating system. But when a program is terminated prematurely files, especially output files, may be left with incomplete or corrupted records.

SuivantPrec.Bas prec.HautNiv. sup.