FORTRAN

Fortran, formerly FORTRAN, is a third-generation, compiled, imperative programming language that is especially suited to numeric computation and scientific computing.

The first manual for FORTRAN describes it as a Formula Translating System, and printed the name with small caps, FORTRAN. Other sources suggest the name stands for Formula Translator or Formula Translation.


Fortran was originally developed by IBM with a reference manual being released in 1956;  however, the first compilers only began to produce accurate code two years later. Fortran computer programs have been written to support scientific and engineering applications, such as numerical weather prediction, finite element analysis, computational fluid dynamics, plasma physics, geophysics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing[5] and is used for programs that benchmark and rank the world's fastest supercomputers.


Fortran has evolved through numerous versions and dialects. In 1966, the American National Standards Institute (ANSI) developed a standard for Fortran to limit proliferation of compilers using slightly different syntax. Successive versions have added support for a character data type (Fortran 77), structured programming, array programming, modular programming, generic programming (Fortran 90), parallel computing (Fortran 95), object-oriented programming (Fortran 2003), and concurrent programming (Fortran 2008).


Before the development of disk files, text editors and terminals, programs were most often entered on a keypunch keyboard onto 80-column punched cards, one line to a card. The resulting deck of cards would be fed into a card reader to be compiled. Punched card codes included no lower-case letters or many special characters, and special versions of the IBM 026 keypunch were offered that would correctly print the re-purposed special characters used in FORTRAN.


Reflecting punched card input practice, Fortran programs were originally written in a fixed-column format.  A letter "C" in column 1 caused the entire card to be treated as a comment and ignored by the compiler. Otherwise, the columns of the card were divided into four fields



Name

Column(s)

Usage

Label Field

1–5

A sequence of digits here was taken as a label for use in DO or control statements such as GO TO and IF, or to identify a FORMAT statement referred to in a WRITE or READ statement. Leading zeros are ignored and 0 is not a valid label number.

Continuation Field

6

A character other than a blank or a zero here caused the card to be taken as a continuation of the statement on the prior card. The continuation cards were usually numbered 1, 2, etc. and the starting card might therefore have zero in its continuation column—which is not a continuation of its preceding card.

Statement Field

7–72

This contains: DIVISION, SECTION and procedure headers; 01 and 77 level numbers and file/report descriptors

Sequence Field (Ignored)

73–80

Used for identification information, such as punching a sequence number or text, which could be used to re-order cards if a stack of cards was dropped; though in practice this was reserved for stable, production programs.



Within the statement field, whitespace characters (blanks) were ignored outside a text literal. This allowed omitting spaces between tokens for brevity or including spaces within identifiers for clarity. For example, AVG OF X was a valid identifier, equivalent to AVGOFX, and 101010DO101I=1,101 was a valid statement, equivalent to 10101 DO 101 I = 1, 101 because the zero in column 6 is treated as if it were a space (!), while 101010DO101I=1.101 was instead 10101 DO101I = 1.101, the assignment of 1.101 to a variable called DO101I. Note the slight visual difference between a comma and a period.


Hollerith strings, originally allowed only in FORMAT and DATA statements, were prefixed by a character count and the letter H (e.g., 26HTHIS IS ALPHANUMERIC DATA.), allowing blanks to be retained within the character string. Miscounts were a problem.


I mostly ever used Fortran in an educational environment.  I had one contract working as a system manager for a PDP-11.34 that ran a set of Frotran programs that were used to model incinerators.  I never had to do any code maintenance for that system.

Sample Code

It took me a while to dredge up the memories of how to write a Fortran application.  The Microsoft Fortran-80 appears to mostly be ANSI Fortran 66.


Here is another looped version of the Hello World program.


H>type hello.for

C Simple Hello World Program

      PROGRAM HelloWorld

      

      INTEGER  I

      DO 10  I=1, 10

10    WRITE(1, 20)  i

20    FORMAT(33H Hello World! From Fortran, Line , i2)

      END


H>f80 hello,hello=hello

HELLOW


H>l80 hello,forlib/s,hello/n,/e:hellow


Link-80  3.44  09-Dec-81  Copyright (c) 1981 Microsoft


Data    0103    1A4B    < 6472>


 FORLIB RQUEST

36370 Bytes Free

[012E   1A4B       26]


H>hello


Hello World! From Fortran, Line  1

Hello World! From Fortran, Line  2

Hello World! From Fortran, Line  3

Hello World! From Fortran, Line  4

Hello World! From Fortran, Line  5

Hello World! From Fortran, Line  6

Hello World! From Fortran, Line  7

Hello World! From Fortran, Line  8

Hello World! From Fortran, Line  9

Hello World! From Fortran, Line 10


H>


References

This article uses material from the Wikipedia article FORTRAN which is released under the Creative Commons Attribution-Share-Alike License 4.0.

Comments

Popular posts from this blog

Still Working on the New Home Page

A New Home Page is in the works!

Old Quizzes that have been taken down