Can anybody explain me how to compile and run a COBOL program in Ubuntu? I have never written any program in Ubuntu. Please, give me a simple program to compile and run.
COBOL is not particularly popular on Linux but there are compilers available. One of these is open-cobol.
First step is to check if it's installed on your system: it probably isn't.
If like my system it is not installed you can install it with
And to check its installed
Now lets write our first program with any text editor.
save this as "helloworld.cbl"
We can now compile it with
On my system I see this
A few warnings -- but no errors test with
Alternative (fixed format):
save this as "helloworld.cob" and compile it with
If you want to remove the warnings from the C compiler: download a current GnuCOBOL 2.x snapshot (which has no updated package yet) and build it yourself (needs an additional
Cobol Hello World Example: How To Write, Compile and Execute Cobol Program on Linux OS on thegeekstuff.com
Tested on Ubuntu 12.04.2
You can use the open-cobol compiler. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below:
Warren Hill gave a good answer. You can also use an IDE such as Eclipse to help with COBOL but I'm not sure that's appropriate if you have never programmed.
See the Eclipse COBOL forum, Eclipse Forums
I noticed one of the posts lists available COBOL plug-ins...
If you want an IDE I highly suggest to use the OpenCobolIDE (works with newer GnuCOBOL compilers as well). You find the latest package at https://launchpad.net/cobcide/+download