Live data from Hacker News

Don't hate COBOL until you've tried it

opensource.com

21–30 of 139 posts

Re: Don't hate COBOL until you've tried it

#21

Oh my God. I wasted a year of my life on a COBOL project. It is easily the worst language I have ever used. There is a reason that COBOL is a linguistic dead-end! Functions? Sensible limited variable scope? A decent approach to handling whitespace so that complex, nested branches make sense? COBOL doesn't even have these basics. Want to declare a variable? You're gonna have to type weird stuff like this: `07 GreatVar…

IBM has been trying to fix this for decades. Either through UML/OO interfacing [not kidding], or 4GL language (a slightly more modern language with cobol use case in mind). I don't despise COBOL, it's mostly a reporting mindset language. Fitted with record file systems you can do some stuff. But if you step outside .. god help you. And if you use X-to-COBOL compilers, then even god cannot help you. Pages and pages of…

  And if you use X-to-COBOL compilers, then even god cannot help you.
Exactly this! I started my professional carreer with COBOL, which I still don't deem to bad for what it was designed.

But we were forced to use Jackson Structured Programing implemented via a pre-compiler (which conveniently ceased to work in regular intervals, since the license expired, but I digress).

You're right! God would have run screaming after one look at the resulting garbage code if we would have the impertinence to ask for help.

Re: Don't hate COBOL until you've tried it

#22
post #19

One thing I don’t understand with these very old languages is that I thought the reason they are still around is because of some programs written in the 70s to early 90s are still around and needs to be maintained. But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that e…

>But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on.

You'd be surprised. The business rules and exactitude of results can be documented in 1000s of pages.

Re: Don't hate COBOL until you've tried it

#23
I have not used COBOL for 30 years but the language deserves respect. The transition from assembler to COBOL was one of the biggest productivity improvements in the history of programming, comparable to the introduction of Java and VM-based programs in the 1990s.

COBOL is still pretty efficient for tasks like scanning data on magnetic tapes--not that most of us do that any more. In fact it was pretty good for any problem that involved reading from or writing to storage devices because you could control the data layouts very precisely. It was great on reports for the same reason. I even wrote a simple doc markdown processor in COBOL because the place I worked didn't have usable word processors and we needed something to do pagination and formatting of docs.

I don't miss the verbosity or the lack of modularity but on the other hand COBOL was an effective tool that you could use to solve problems more quickly than other tools available at the time.

Re: Don't hate COBOL until you've tried it

#24
post #8

Earlier quoted context omitted.

If you have an existing COBOL app you can convert it to a web app and develop using a simpler syntax with more features through SystemZ from Zortec Intl. I've worked with them personally and they were super-duper. COBOL isn't so bad when you use a modern variant that purposefully deals with many of the complaints surrounding it.

Yes, thanks for missing the joke.

No problem and glad to be of [di]service. I was familiar with the URL you posted, and probably should not have commented as a reply to you, but there you have it. :)

Re: Don't hate COBOL until you've tried it

#25
post #19

One thing I don’t understand with these very old languages is that I thought the reason they are still around is because of some programs written in the 70s to early 90s are still around and needs to be maintained. But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that e…

> What makes it that expensive that no one wants to rewrite them in a modern language?

From a business perspective there may not be much to gain from doing so. If the old software works in a current environment then there often isn't a justification for the cost of rewriting/testing/integrating just to end-up with the same thing in a shiny new language.

Re: Don't hate COBOL until you've tried it

#26
post #13

Once in a while I decide I want to play with COBOL, so I install GNU COBOL, dig out my old test code and try to use it to do something interesting. So, most recently I wanted to simply read a file, do some simple processing and then write an output file. Very basic, right? Not so much with COBOL. First you have to statically declare the files you want to use. Let's say you want to read from "foo.txt": environment div…

10 is EOF, 0 is successful read. Not that it actually matters, your point is perfectly valid. You can use sort off boolean operators thats toggled on based on the value in variables.

Outgoing web requests are usually done via either a program in some other language that you call from the COBOL application, or via DB2s built in functionality by running it as an embedded SQL section in your program. Why the heck web requests are handled by the relational database is.. Well I mean it feels odd, but by doing it that way they added the functionality to both zOS and IBM i at once. And old developers don't have to learn all to much new stuff to do it.

Also, while the COBOL program works with a static set of files with static filenames. Those names can point to any file by various overrides done in either JCL on the mainframe or CL on the IBM i/AS400. Regarding the file formats, you can read the file into different working-storage defined variables, so each row doesn't have to be identical field length/position. In short, COBOL is just one part of the solution. Various "scripting" languages play a large part in defining what files go in and out. And none of them are available outside of the actual mainframe/midrange environments. Most data is gathered from relational databases anyway nowdays, and embedded SQL, just like in PHP webpages of yesterdays web, is whats used in newly developed programs.

But all in all, yes it's a rather cumbersome language, for any sort of sane string handling you have to revert to embedded SQL. But most problems you have to write programs to solve can usually be broken down into smaller problems. Then just chain programs to handle it. The language itself is usually just a bit of a bother, but the age old programs written 20-30 years ago written by developers of varying degrees of sanity who had no requirements on them to document their work is what makes the job a pain.

Re: Don't hate COBOL until you've tried it

#27
I had to program in COBOL for one year when I was in college (in the 70's), I hated it. After that I had to program for one semester in IBM 360 assembly language, which turned out to be a far more interesting and enjoyable programming language.

Re: Don't hate COBOL until you've tried it

#28
post #19

One thing I don’t understand with these very old languages is that I thought the reason they are still around is because of some programs written in the 70s to early 90s are still around and needs to be maintained. But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that e…

> But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that expensive that no one wants to rewrite them in a modern language?

You would be utterly shocked.

I did some COBOL work for a bank.

Most of the new code they write is in C++.

However, COBOL was still a huge part of their stack, and they still had several heavy duty mainframes that it ran on, and maintaining that was part of my job.

For an example of how much COBOL was written back then, and how huge the technical debt to replace it would be:

* The interbank transfer system alone was ~750,000 lines of COBOL.

* It handled around 1.2million transactions every three seconds. That's not capacity, that's real world data.

* They had less than five minutes of downtime in the last twelve months, and that was considered poor.

It's a mammoth task to replace the system, and getting transactions from the old to the new without incurring a huge overhead is nigh impossible. And yes, dropped transactions can mean dropped customers, and big customers.

It's far cheaper to hire and train programmers in COBOL, than to rewrite everything. COBOL and Fortran have millions of lines of code in use, and such frequent use that replacing them may cost more than the lifetime of returns would give.

Re: Don't hate COBOL until you've tried it

#29
post #19

One thing I don’t understand with these very old languages is that I thought the reason they are still around is because of some programs written in the 70s to early 90s are still around and needs to be maintained. But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that e…

I once spent a month completely figuring out a 5000 line C program. You'd be amazed at the complexity a programmer can fit into a small number of lines, particularly when they knew memory mattered, so they needed to make best use of every byte.

Re: Don't hate COBOL until you've tried it

#30
post #19

One thing I don’t understand with these very old languages is that I thought the reason they are still around is because of some programs written in the 70s to early 90s are still around and needs to be maintained. But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that e…

> But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on

An ex-colleague used to work for a major US insurance company, and this is what he told me: They had a bunch of products, and due to the state-by-state nature of US insurance regulation, they had a slightly different version of each product for each of the 50 US states. And then, for every one of those different versions of those products, they had a separate suite of COBOL programs to manage them. And, all these COBOL programs basically did the same things, but all with slight variations due to the different rules of each state's insurance regulators. So they basically had hundreds, maybe even thousands, of separate COBOL programs to maintain, a mess of horribly repetitive code. Their problem with moving off COBOL was not that any of the code was particularly complex, just that there was so much of it, and trying to rewrite it into another language (or, maybe more sensibly, translate it into some sort of business rules engine or insurance policy automation product) would take major effort and run a big risk of getting something wrong in the translation. (He worked there more than 15 years ago, so things at this insurance company might be very different by now.)

Post reply on HN