Next: Symbolic Names
Up: Statement Types and Order
Previous: Statement Types and Order
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.