next up previous contents index
Next: END Statement Up: Program Structure and Layout Previous: Reserved Words

PROGRAM Statement

  The PROGRAM statement can only appear at the start of the main program unit. Its only function is to indicate what type of program unit it is and to give it symbolic name. Although this name cannot be used anywhere else in the program, it may be used by the Fortran system to identify error messages etc. The general form is simply:
PROGRAM name
Where name is a symbolic name. This name is global in scope and may not be used elsewhere in the main program nor as a global name in any other program unit. For compatibility with Fortran66 the PROGRAM statement is optional. This can have unexpected effects: if you forget use a SUBROUTINE or FUNCTION statement at the start of a procedure the compiler will assume it to be a (nameless) main program unit. Since this will normally result in two main program units, the linker is likely to detect the mistake.



Mario Storti
Wed Nov 4 19:32:56 ART 1998