Live data from Hacker News

What are Fortran and Cobol used for today?

stackoverflow.com

21–30 of 72 posts

Re: What are Fortran and Cobol used for today?

#22
As an ex-COBOL programmer, I did some research in this area and I uncovered the following (from a 2009 blog post of mine).

--

Do a little research into COBOL and a few interesting things jump out at you. Some of this information is from Gartner Group and the rest can easily be verified by doing even a brief survey of the field. Taking the following bits of information:

* 75% of the world's business data passes through COBOL (Gartner Group estimate)

* There is possibly up to a fifth of a trillion lines of COBOL code out there (Gartner again)

* People are still writing COBOL constantly, but usually on existing systems.

* The industry is struggling to find new COBOL programmers because few young programmers love the thought of maintaining decades-old enterprise systems where all data is global and GOTO is often the first choice in flow control.

* Many companies want to move from COBOL, but can't do so easily because too much code is written in COBOL (and the source is often lost).

People really, really underestimate these problems. For example, I've seen several companies express a desire to move away from Perl but find out they can't because they don't realize quite how reliant on the language they are.

Now imagine a multi-national corporation with several million lines of COBOL code. What are they going to do?

COBOL salaries, from what I've seen, are trending upwards. Older programmers are sometimes being enticed out of retirement to maintain legacy systems (this is rather hit or miss as there appears to still be some age discrimination here). There are companies out there offering software to allow COBOL programmers to write NetBeans, integrate with .NET code or simply translate the COBOL into other languages (the latter appears to have mostly been a disaster, but I don't have enough hard data on this).

So let's summarize the above:

* Trillions of dollars flow through COBOL. * Trillions of dollars flow through systems that businesses want to replace. * Current mitigation strategies involve supplementing COBOL, not replacing it.

You come up with a strategy to allow COBOL systems to naturally migrate to a new language and you stand to make millions of dollars. By the way, I said "naturally". There are things like COBOL to Java translators (e.g., http://opencobol2java.sourceforge.net/), but COBOL is procedural and all variables are global. It doesn't even come close to mapping to an object-oriented paradigm (and any experienced OO programmer will understand why).

I actually have what I think is a decent migration strategy for COBOL, but that's a story for another day.

Re: What are Fortran and Cobol used for today?

#23
post #11

Scaring baby programmers. Oh, and lots of scientific computing is done in Fortran - eg. the sorts of work my brother does on atomic structure as a computational chemist at ITU, running on grid or supercomputers. On the flip side, there's lots of very large, poorly documented programs which are effectively "mission critical" Fortran. Until someone ponies up a LOT of money to re-write and revalidate them, Fortran ain't…

My first programming experience was with FORTRAN (for a task that did not require any sort of high performance computing), and this scared me away from programming for six years. I realize the language isn't really to blame, but I'm definitely a little bitter.

Re: What are Fortran and Cobol used for today?

#24
This SO answer has interesting comments on Fortan performance: http://stackoverflow.com/a/13079021

And this appropriately grumpy rebuttal from a JPL guy to the 2004 "Petition to Retire Fortran" makes some good arguments for not retiring it (and also gives some Ada love): http://www.fortranstatement.com/Site/responses.html

Re: What are Fortran and Cobol used for today?

#25
post #14

Earlier quoted context omitted.

Given the right tools[1] you can have as much templating/macro support as in C++ while keeping everything both performant and user friendly. The key here is to wrap Fortran in script languages to make it do exactly what you want. [1] https://github.com/muellermichel/Hybrid-Fortran (I'm the maintainer.)

> while keeping everything both performant Good luck beating the performance of a Fortran optimizing compiler.

Why? Any objective reason?

Re: What are Fortran and Cobol used for today?

#26
post #25
post #14

Earlier quoted context omitted.

> while keeping everything both performant Good luck beating the performance of a Fortran optimizing compiler.

Why? Any objective reason?

One thing that for years made Fortran stand out is that the language explicitly assumes all arrays passed in to a subprogram have no overlaps.

Thus a Fortran compiler doesn't have to do anything special to make sure it preserves order when storing and accessing from two different arrays. Therefore the compiler can be much more aggressive about unrolling loops and changing the order of operations.

By contrast, given a loop like

  for( i=0; i
a C compiler has to assume that y[i] might be the same memory location as x[i+1], for example. Thus it has to ensure that the load into y[i] is complete before accessing x[i].

This is one reason you see a lot of C code that does numerical work hand-unrolled, with explicit stores, like this:

  for( i=0; i
Now that C provides the "restrict" keyword, a smart C compiler can do many of the same optimization tricks that Fortran has had since day 1.

Re: What are Fortran and Cobol used for today?

#27
post #5

I believe we should think of Fortran as a domain-specific language for handling multidimensional arrays, rather than a normal programming language. It might be terrible for other things, but it's great for array computations, and that's what people use it for in big simulations. Since it has a well-defined C FFI nowadays, it's easy to connect it to other languages that can do other things (parsing data files, etc.).…

In general, I agree with you. However, modern Fortran also has a strong module system, and some nice looping constructs (like explicitly-labeled loops that let you control "breaking" and "continuing" in nested loops quite easily), that made me like using it for even non-array-oriented programs (for other reasons, I don't use Fortran so much anymore).

The only thing I absolutely hated about Fortran for parsing data files is that, according to the standard, a text file has to end with what amounts to an empty line. Many Fortran environments break this rule intentionally, but occasionally you'll find one that follows the rules. It inevitably bites people who forget that their last line of data must be followed by a newline, or else the line may never get read.

Re: What are Fortran and Cobol used for today?

#28
post #25

Earlier quoted context omitted.

Why? Any objective reason?

One thing that for years made Fortran stand out is that the language explicitly assumes all arrays passed in to a subprogram have no overlaps. Thus a Fortran compiler doesn't have to do anything special to make sure it preserves order when storing and accessing from two different arrays. Therefore the compiler can be much more aggressive about unrolling loops and changing the order of operations. By contrast, given a…

One thing that for years made Fortran stand out is that the language explicitly assumes all arrays passed in to a subprogram have no overlaps.

There's a HUGE number of languages that don't allow aliasing in this way. I wasn't thinking about "how to improve C", I had APL, J, K, Q etc. in mind, as well as languages that implement mass array processing with similar semantics in terms of a more conventional syntax.

Re: What are Fortran and Cobol used for today?

#29
post #22

As an ex-COBOL programmer, I did some research in this area and I uncovered the following (from a 2009 blog post of mine). -- Do a little research into COBOL and a few interesting things jump out at you. Some of this information is from Gartner Group and the rest can easily be verified by doing even a brief survey of the field. Taking the following bits of information: * 75% of the world's business data passes throug…

> * People are still writing COBOL constantly, but usually on existing systems.

From what I've seen (somewhat limited honestly) it's less "writing" and more like "patching". Minimal maintenance features like adjusting tax rates, accepting 4 digit years, updating country names etc. I wouldn't even call them minor features enhancements, more like routine maintenance.

Re: What are Fortran and Cobol used for today?

#30
post #11

Scaring baby programmers. Oh, and lots of scientific computing is done in Fortran - eg. the sorts of work my brother does on atomic structure as a computational chemist at ITU, running on grid or supercomputers. On the flip side, there's lots of very large, poorly documented programs which are effectively "mission critical" Fortran. Until someone ponies up a LOT of money to re-write and revalidate them, Fortran ain't…

And the main use of Python is scaring fogey programmers?
Post reply on HN