HP Fortran Programmer's Reference (September 2007)

Language elements
Source format of program file
Chapter 248
Source format of program file
The HP Fortran compiler accepts source files in fixed form (the standard source form for
FORTRAN 77 programs) or free form. The following sections describe both forms.
The compiler assumes that source files whose names end in the .f90 extension are in free
source form and that files whose names end in the .f or .F extension are in fixed form. You
can override these assumptions by compiling with the +source=free or +source=free
option. See the HP Fortran Programmer’s Guide for more information.
Although the two forms are quite different, you can format a Fortran 90 source file so that the
compiler would accept it as either fixed or free form. This would be necessary, for example,
when preparing a source file containing code that will be inserted through the INCLUDE line
into a file for which the form is not known. To format a source file to be acceptable as either
free or fixed source form, use the following rules:
Put labels in columns1-5.
Put statement bodies in columns 7-72.
Begin comments with an exclamation mark in anycolumn except column 6.
Indicate all continuations with an ampersand character (&) in column 73 of the line to be
continued and an ampersand character in column 6 of the continuing line.
Do not insert blanks in tokens.
Separate adjacent names and keywords with a space.
Free source form
In free source form, the source line is not divided into fields of predefined width, as in the fixed
form. This makes entering text at an interactive terminal more convenient.
Source lines
Freeform lines can contain from 0 to 132 characters. The +extend_source option extends the
line to column 254. This is described in the HP Fortran Programmer’s Guide. Several
statements can appear on a single source line, separated by semicolons. A single Fortran 90
statement can extend over more than one source line, as described below in “Statement
continuation” on page 50.
Multiple statements may appear on the same line, separated by a semicolon (;).