A Fortran program must include one main program. It takes the following form:
[PROGRAM name] [specification-part] [execution-part] [CONTAINS internal-subprogram-part] END [PROGRAM [name]]
An automatic object must not appear in a specification statement. If a SAVE statement is specified, it has no effect.
The PROGRAM statement is optional. Within a program unit, a PROGRAM statement can be preceded only by comment lines or an OPTIONS statement.
If a name follows the END statement, it must be the same as the name specified in the PROGRAM statement. The program name cannot be the same as any local name in the main program or the name of any other program unit, external procedure, or common block in the executable program.
A main program must not reference itself (either directly or indirectly).
The following is an example of a main program:
PROGRAM TEST INTEGER C, D, E(20,20) ! Specification part CALL SUB_1 ! Executable part ... CONTAINS SUBROUTINE SUB_1 ! Internal subprogram ... END SUBROUTINE SUB_1 END PROGRAM TEST
For details on the default name for a main program, see your user manual or programmer's guide.