What's The Difference Between FORTRAN - Now And Then

FORTRAN has progress since its inception at IBM in 1957. It now sports object oriented programming and parallel programming features.

FORTRAN started out as IBM's' Mathematical Formula Translating System. It was designed by a team led by John Backus and targeted computationally intensive applications from physics to weather prediction. Initially programming die hards thought that optimum performance required coding in assembler. C and C++ may be the programming language of choice today but FORTRAN remains popular in high performance computing (HPC) applications. The latest FORTRAN compilers and standard might change your mind about whether FORTRAN is a historical artifact or an effective tool.

FORTRAN is almost as old as I am and I encountered if at FORTRAN IV when punch cards, GOTO's and line numbers still existed. I still remember the three-way, arithmetic IF statement that ended with three line numbers for less than, equal and greater than results. Files were referenced by numbers and FORMAT and DATA statements were sprinkled throughout a card deck.

In my distant past I wrote a FORTRAN development system in BASIC because the only computer we had access to ran BASIC and we really wanted to try FORTRAN. The BASIC system had a remote terminal with paper tape while the FORTRAN system was only available via punch cards that were shipped out daily. Imagine a two day debug turn around.

The initial version of FORTRAN had only 32 statements. This included the FREQUENCY statement that was a hint to the new "optimizing" compilers to improved IF statement performance. It was a precursor to C's pragma statement. The IF statement mapped to the IBM 704 branch instruction. This is comparable to C/C++ auto-increment/decrement support that matched features in the hardware at the time.

FORTRAN has progressed significantly since then. There have been numerous FORTRAN versions and specifications including:

  • FORTRAN
  • FORTRAN II
  • FORTRAN III
  • FORTRAN 1401
  • FORTRAN IV
  • FORTRAN 66
  • FORTRAN 77 - ANSI X3J3/90.4
  • FORTRAN 90 - ISO/IEC standard 1539:1991
  • FORTRAN 95
  • FORTRAN 2003
  • FORTRAN 2008 - ISO/IEC 1539-1:2010

Along the way things like three-way, arithmetic IF statement gave way to the more contemporary IF/THEN/ELSE/END IF construct. Recursion is now supported. Initially recursion was not an option. That actually made my job easier when I put together that FORTRAN simulator. Looping was improved as have data types. There is even support now for object oriented programming. Variable length strings were not added until FORTRAN 95.

Dynamic memory allocation showed up in Fortran 90 along with pointers. Programmers got a taste for modules, operater overloading, structures and structre looping constructs. A portable specification for numerical precision kept FORTRAN at the forefront of numerical calculation.

Identifier lenths were increased to 31 characters and input was now free form. Initially, FORTRAN punch cards were laid out with in 80 columns with leading line numbers. Many will remember terminal screens that were 24 lines of 80 characters.

Many features were deleted in FORTRAN 90 including ASSIGN/GOTO Still, FORTRAN was often playing catch up with other emerging languages including C.

FORTRAN 2003 was a major revision. It provided interoperability with C and included object-oriented programming support (Fig. 1) such as type extension, inheritance, polymorphism and abstract data types. Subroutines could now be polymorphic based on their argument types like Ada and C++.

type shape
  integer :: color
  logical :: filled
  integer :: x
  integer :: y
end type shape
type, EXTENDS ( shape ) :: rectangle
  integer :: length
  integer :: width
end type rectangle
type, EXTENDS ( rectangle ) :: weighted_rectangle
  integer :: weight
end type weighted_rectangle

subroutine sample ( sh )
  class(shape), intent(in) :: sh

  select type (sh)
  class is (rectangle)
    stop 'We have a rectangle'
  class is (weighted_rectangle)
    stop 'We have a weighted_rectangle'
  class default
    stop 'We have something else'
  end select
end subroutine sample

Figure 1. FORTRAN 2003 added object class definitions with inheritance

IEEE floating point support was now standard. The VOLATILE attribute was added along with a range of data manipulation enhancements. Asynchronous file transfer and stream support brought FORTRAN into the new millenium.

FORTRAN 2008 was approved in 2010. Compared to FORTRAN 2003, it is a minor upgrade. Objects can now be declared within a BLOCK construct and storage layout can be forced with the CONTIGUOUS attribute. Recursive allocatable objects means that FORTRAN can now handle arbitrary linked structures. It addresses issues such as deep copying and memory leaks. It adds submodules (Fig. 2) and support for Coarray Fortran (CAF). Submodules are very handy in large applications and for sharing code.

module points
  type :: point
    real :: x,y
  end type point
  interface
    real function point_dist (a,b)
    import :: point
    type(point), intent(in) :: a,b
    end function point_dist
  end interface
end module points
submodule (points) points_a
contains
  real function point_dist (a,b)
    type(point), intent(in) :: a,b
    point_dist = sqrt((a%x-b%x)**2+(a%y-b%y)**2)
  end function point_dist
end submodule points_a

Figure 2. Submodule example from "The new features of Fortran 2008" by John Reid, JKR Associates, UK

CAF programs can be replicated and executed asynchronously. The FORTRAN array syntax has been extended to handle coarrays.

Compared to very early versions of FORTRAN, FORTRAN 2008 looks like a completely different language and it is. On the other hand, it has many familiar or similar constructs and syntax found in C++ and Ada.

FORTRAN 2008 will probably not be used by the average embedded developer or an iPhone and Android app developer. On the other hand, it will be used by everyone from physicists to those crafting military applications.

Discuss this Article 13

OLDER&WISER
on Feb 12, 2013

WOW!, Bill, did you bring back memories!!!

I worked FORTRAN on two I-B-M's, the 1401 (also AUTOCODER & RPG), and the 1130 (FORTRAN IV). Don't have any more of the object decks, but I DO STILL have my "official" I-B-M flowchart templates & my FORTRAN IV books. IF my memory serves me, the FORTRAN 1401 books were I-B-M property, and we could not keep them as personal additions to our technical libraries. The FORTRAN IV book was an independent publication, a rare occurrence in those days. Now, B&N has about 10 different choices for WINDOWS 8 already! Quite a difference!!!!

I can remember dropping (more than once!) an assembled card deck (I-B-M 547 Collator???) just seconds before loading it into the hopper. By the way, one point you didn't explicitly mention about FORTRAN is that you could solve equations of the form y = ax +/- jb (complex variables). That made solving circuit problems with capacitance & inductance a joy!!!

Thank you for the memories!!!!

Bill Wong
on Feb 12, 2013

I forgot about complex data types. Definitely handy. I actually remember playing with the 029 and collators before I had access to a computer. That was when I learned to touch type. It was well worth the effort.

varptr
on Feb 12, 2013

Time: grad student 1969. Fortran card stacks of amino acids data carefully typed, ordered, and rubber banded so that other protein pairs could be assembled in minutes. Computer creates DNA sequences and detects point mutations, inversions, and translocations by sliding one sequence across the other, massive calculations, I double check the results, magnificent. But I accidentally send one byte at a time to printer instead of spooling to file. 2 days later, department receives bill for $32,000 instead of usual $2.50 normal fee. Whoops!! Drafted! Changed departments. Thanks Vietnam, without you I would not have graduated! Indeed, the hostile bees may still swarming 40 years later. Sorry bees, too late, go away.

Bill Wong
on Feb 12, 2013

The good old days. My wife actually worked in the computer room on the third floor and one day a grad student came around the counter, pulled a card deck from the reader and put in his own like he owned the place. My wife walked over, took out his deck and palmed it, walked to the window and threw out a blank set of cards. After they guy almost had a heart attack she gave him back his cards and told him never to do that again or the real deck would go out the window. Never happened again.

ChuckG
on Feb 12, 2013

FORTRAN (or "Fortran", after F90) has undergone a lot of changes, not all of them happy. The utter simplicity of USA BASIC FORTRAN allowed for severely-resource limited systems to have a higher-level language. Anyone remember when DEC offered a PDP-8 with FORTRAN for $5K? I think the system had 8K of 12-bit words and ran from paper tape.

As most of the material for this article seems to have been taken from Wikipedia, there are a few inaccuracies, but all in all, a good read.

Having done time on X3J3 during what was to have been F88, but turned into F90, I witnessed several real donnybrooks between vendors and the committee. It brought to a head the question of "Does a standards committee merely endorse current practice or does it invent new technology?" Both DEC and IBM threatened to leave X3J3 over the refusal of the committee to endorse each vendor's extensions (In IBM's case, it was over IBM's VECTRAN vector extensions).

However, trusting a vendor to be rigorous in designing language extensions was a bit foolish. Long after CDC had come out with their FTN FORTRAN compiler, a user turned up a real issue in one extension. A hollerith constant could be delimited by any character at its beginning and end (important because there was no single- or double-quote in the standard 6-bit display character set). So, H*HELLO* was equivalent to 5HHELLO, for example.

At the time, FORTRAN did not have reserved keywords, so "FORMAT", for example could easily be the name of a variable. One clever user coded the following statement (or something akin to it):

400 FORMAT( H)=((A+3))

If the variables FORMAT, A and H existed, how does one interpret the statement? CDC's response was to acknowledge the issue and then hope that it would go away on its own.

There was a FORTRAN V, but it was a Univac-specific product for its 1100 series machines.

Remember that back in the day, decimal machines were also part of the computing scene, so an IBM 1620 CADET could have FORTRAN. As far as I am aware, C cannot be implemented on a decimal machine.

I still miss the old "handful of statements" FORTRANs that could run on any bit of hardware, but then, I suppose that BASIC took its place.

Bill Wong
on Feb 12, 2013

I remember keying in the boot loader for the paper tape on the PDP and Data General minicomputers. The first tape was used to load the next one.

Basic really didn't take FORTRAN's place but opened up more options for programmers. Both have changed a lot over the years.

ChuckG
on Feb 12, 2013

Would it be fair to say that APL was the first HLL to be implemented on a microcomputer? On the 8080 and 6800 hobbyist systems, BASIC was probably the first--I don't think I saw an 8080 FORTRAN until about 1978 or so, but there were several early BASICs.

Bill Wong
on Feb 13, 2013

Do you have any references on APL? Assembler was there first but PL/M was the first thing I used on an Intel chip. BASIC as there early on. There was even Lisp.

Dennis_T1
on Feb 12, 2013

That takes me back. I started in '71 with FORTRAN 4 on an IBM 1130 as a student. My favorite story there is that I was accustomed to using the model 26 key punch for FORTRAN. I signed up for the COBOL class and used the model 26 and the COBOL compiler ate the student disk. I was persona non grata for a while.
My first professional job was with Fortran 4 on a Data General minicomputer, and it permitted recursion and had realtime extensions.

arthur
on Feb 13, 2013

Hey! Anybody want a copy of my DOS abacus program? It seems as useful as FORTRAN. Both died a long time ago. How many of you have seen an advertisment for a Fortran programmer in the last 20 years? What sys admin in his right mind would decide to use it? Great history article though, but completely irrelevent today.

Bill Wong
on Feb 13, 2013

You may have to look in the right spot but FORTRAN and even COBOL programming jobs are out there. They also pay well because the competition is not there. Most everyone has Java or C/C++/C# on their resume. A lot of the work is support of existing software but improving or extending that is also happening. You will not find either very often in new embedded development but that is not where these languages were strong.

OLDER&WISER
on Feb 13, 2013

Arthur,
Since the latest edition of FORTRAN is 2008, an IEC publication, it MAY just be that there are some serious SYS ADMINs who WOULD specify the project being written in FORTRAN....... ya' think, maybe??????? So, just to be on the safe side, you might wanna keep your (MS) DOS Abacus program also......

Bill Wong
on Feb 14, 2013

If anyone wants to play there is a GNU FORTRAN called GFORTRAN.

http://gcc.gnu.org/wiki/GFortran

Please or Register to post comments.

Search Parts

 

powered by:

 

 

Newsletter Signup

Forums

Pick Your Components With Confidence:
"Here are the procedures can help you
make the right choice..."

Search Parts

 

powered by:

 

 

Newsletter Signup

Connect With Us