Comment by mindcrime
7 years ago
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:
*> GnuCOBOL Hello World example
identification division.
program-id. hello.
procedure division.
display "Hello, COBOL world!"
end-display.
goback.
If you save that in a file named hello.cob and compile it with
$> cobc -free -x -o hello hello.cob
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:
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
No comments yet
Contribute on Hacker News ↗