FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-2
Program Line Format
Program Line Format
FORTRAN program lines are initial lines, continuation lines, comment lines, or
compiler directives.
By default, each source line can be a maximum of 132 characters. FORTRAN treats
characters beyond the maximum line length as comments. You can use the COLUMNS
compiler directive to change the maximum length of a source line to any number of
characters from 12 through 132.
The ANSI standard requires that source lines be exactly 72 characters. When the ANSI
compiler directive is in effect, each line can be from 72 to 132 characters in length. If a
line is shorter than 72 characters, the compiler appends blanks to make it 72
characters. If a line is longer than 72 characters, the compiler treats characters beyond
position 72 as comments.
The ANSI directive differs from the COLUMNS 72 directive. When the ANSI directive is
in effect, the compiler ensures that all source lines are at least 72 characters long by
appending blanks to lines that contain fewer than 72 characters. If the COLUMNS 72
directive is in effect, the compiler does not append blanks to lines that have fewer than
72 characters. The difference between the COLUMNS 72 directive and the ANSI
directive is important when a character constant is continued from one line to the next.
If your program specifies both an ANSI directive and a COLUMNS directive, the ANSI
directive overrides the COLUMNS directive.
Table 2-1. FORTRAN Character Set
Alphabetic a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Numeric 0 1 2 3 4 5 6 7 8 9
Special = Equals , Comma
+ Plus . Decimal point
- Minus $ Currency symbol
* Asterisk ' Apostrophe
/ Slash : Colon
( Left parenthesis Space
) Right parenthesis
HP Extensions ^ Circumflex % Percent
\ Backslash ? Question mark
_ Underscore " Quotation mark