A source program line is a sequence of character positions, called columns, numbered consecutively starting from column 1 on the left.
The two formats for Fortran programs are
1. Fixed Format
A Fortran line is divided into columns, with one character per column as indicated in Table below.
Table: Fortran Line Structure
The –col72, –col120, –extend_source, and –noextend_source command line options are provided to change this format.
2. TAB Character Formatting
Rather than aligning characters in specific columns, the TAB character can be used as an alternative field delimiter, as follows:
However, you can use an exclamation point (!) to explicitly define a comment field. The comment field extends from the exclamation point to the end of the line.
The rules for TAB formatting can be summarized as statement label TAB statement (initial line)
TAB continuation field statement (continuation line)
TAB statement (initial line)
Note that although many terminal and text editors advance the cursor to a predetermined position when a TAB is entered, this action is not related to how the TAB will be ultimately interpreted by the compiler. The compiler interprets TABs in the statement field as blanks.
Types of Lines
The four types of Fortran program lines are
A comment line is used solely for documentation purposes and does not affect program execution. A comment line can appear anywhere in a program and has one of the following characteristics:
2. Debugging Lines
Specify a D in column 1 for debugging purposes; it conditionally compiles source lines in conjunction with the –d_lines option described earlier. When the option is specified at compilation, all lines with aD in column 1 are treated as lines of source code and compiled; when the option is omitted, all lines with aD in column 1 are treated as comments.
3. Initial Lines
Initial lines contain the Fortran language statements that make up the source program; these statements are described in detail in “Program Organization”. These fields divide each Fortran line into
The fields in a Fortran line can be entered either on a character-per-column basis or by using the TAB character to delineate the fields, as described in the previous section.
4. Continuation Lines
A continuation line continues a Fortran statement and is identified as follows:
As with initial lines, columns 7 through the end of the line contain the Fortran statement or a continuation of the statement.
Alternatively, you can use an ampersand (&) in column 1 to identify a continuation line. Using an & in column 1 implies that columns 2 through the end of the line are part of the statement. In Fortran 77, any remaining columns (column 73 and on) of a continuation line are not interpreted.
The maximum number of consecutive continuation lines is 99 unless you change this limit with the –NC compiler option.
Fortran Elements And Concepts
Constants And Data Structures
Assignment And Data Statements
Statement Functions And Subprograms
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.