Scor­pio News

  

January–March 1987 – Volume 1. Issue 1.











Page 9 of 63











An Introduction to FORTRAN

by P.D. Coker

(In this article, F80 refers to Microsoft FORTRAN-80, ProFortran to the 8-bit Version of FORTRAN from Prospero Software. NFortran refers to Ellis Computing’s Nevada Fortran and FORTRAN refere to other versions such as FORTRAN IV oF FORTRAN 77.)

WHY USE FORTRAN?

FORTRAN is, as computer languages go, very old, having first seen the light of day about 30 years ago as a scientific and technical high level language for early IBM mainframes – it’s older than ALGOL and BASIC (which owes a lot of its style to FORTRAN II) and, by comparison, PASCAL and C are infants!

Most users are aware of the drawbacks of interpreted languages – particularly in terms of execution time. FORTRAN is a compiled language in which the source code is written using a text editor and then compiled into a run-time package which will execute much move rapidly than is the case with an interpreted language. There are two disadvantages to this, however. One is that any amendments which need to be made to the program involve editing and recompiling the source code which can be tedious. The other problem is one of cost. Virtually all compiled languages are expensive (£150 – 350), although HiSoft PASCAL (a very satisfactory version) costs quite a lot less. There is a very good FORTRAN compiler, sold by Grey Matter of Ashburton, South Devon which is incredibly cheap. For £30 you get Nevada Fortran and a useful Guide – admittedly, the implementation of FORTRAN is not complete – but few will miss the bits the author has left out!

So, if you are fed-up with your BASIC and want to try a compiled language, then it really is worthwhile trying NFortran. True, FORTRAN is a little less flexible and efficient than PASCAL but the conversion of programs from BASIC to FORTRAN is relatively simple and straightforward. I must admit to being professionally biased in favour of FORTRAN but some versions of PASCAL are very finicky about syntax.

PROGRAM STRUCTURE

In BASIC, program entry is very straightforward with line numbers and statements typed in directly but in FORTRAN, the program statements must first be entered using a text editor such as WordStar (in non-document mode) or PEN before calling the compiler. All versions of FORTRAN use up to 80 columns per line of input, organised as follows:

Cols1 – 5Optional statement number (1 – 99999)
Col6‘Continuation’ character field (used only if the number of columns used by the statement exceeds 72)
Cols7 – 72FORTRAN statement
Cols73 – 80(can be used for identification, rude words or whatever)

COMMENTS

In BASIC, REM statements (or comments preceded by single quote (') can be used to highlight information about programs. In FORTRAN, the use of a letter C in column 1 performs the same function; lines so marked are ignored by the compiler












Page 9 of 63