Ask HN: Good resources to learn COBOL?
7 years ago
I recently saw a thread that advocated for COBOL as a programming language. I have a lot of opinions about it, but they are all very very biased. I've never seen a line of COBOL and I already think the language is bad.
It's time to change that and ask myself the uncomfortable question what are good resources to learn COBOL? Some systems still use it, better get good at our legacy systems. Also, it might be fun as a language to play with. If one person is willing to advocate for it, it might have merit.
I wouldn't know if it does, all I know is that there are wonderful resources for a lot of programming languages on HN to find, but not for COBOL. So does anyone know good learning resources?
I've played around with it a bit. Created the /r/cobol subreddit a long time ago as a joke, and it surprisingly became a moderately active community. So I guess I feel a certain measure of affinity for the language in a weird "goofy little brother" sense.
Anyway, there's an F/OSS COBOL compiler out there - GNU COBOL, so it's possible to play around with the language without needing an IBM mainframe or minicomputer, or expensive MicroFocus stuff for your PC.
"Hello, World" in COBOL is a little verbose, but it's nothing too crazy:
If you save that in a file named hello.cob and compile it with
you should get a binary that will execute and print "Hello, COBOL World!". Note that the "-free" part is pretty important. Historically COBOL was a language (like RPG, and - I think - FORTRAN) that was column oriented, and certain characters had to fall into specific columns, or it wouldn't compile. Modern COBOL allows a free form mode like C or Java, and that -free flag turns it on. Without it that sample won't compile as-is.
There's some useful information here:
https://open-cobol.sourceforge.io/faq/index.html
https://open-cobol.sourceforge.io/doc/gnucobol.pdf
and one or two useful links here:
http://www.csis.ul.ie/cobol/
You might also ask on https://cobol.reddit.com
Outside of that, my best recommendation is to try queries like
cobol site:.edu
cobol site:.ibm.com
This online compiler is pretty cool for just experimenting: https://www.jdoodle.com/execute-cobol-online