Execute OpenCobol

Asked by peter

Hello

Maybe this is not the right place to ask this question. I asked the same question in the OpenCobol forum, but till yet I haven't been getting an answer.

I've installed OpenCobol. I've created a launcher, but the launcher didn't work. Do you know how I can execute OpenCobol? Thanks for your hint.
Peter

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu open-cobol Edit question
Assignee:
No assignee Edit question
Solved by:
peter
Solved:
Last query:
Last reply:
Revision history for this message
Adam Buchbinder (adam-buchbinder) said :
#1

Did you install the "open-cobol" package through the package manager? (Synaptic, aptitude, apt-get or something like that?) The open-cobol package installs command-line utilities, so running them from a launcher is unlikely to be helpful. You'll have to open a terminal window, navigate to where your .cbl files are, and run "cobl file.cbl" (with the name of your COBOL source there instead, of course) to compile your code.

Revision history for this message
Adam Buchbinder (adam-buchbinder) said :
#2

Sorry about that; the proper command is "cobc file.cbl", not "cobl".

Revision history for this message
peter (peter-neuweiler) said :
#3

Hi Adam

Yea, I installed it by Synaptic. Thanks for your answer and have a good time.
Peter

Revision history for this message
Adam Buchbinder (adam-buchbinder) said :
#4

Okay, then you should have it in your path. In case you need it, here's a little more detail, here. I've uploaded a sample COBOL program to Ubuntu's pastebin. Open up a terminal session and do the following. (The "$" is the prompt; you type in what appears after it.)

$ wget http://paste.ubuntu.com/104952/plain/ -O student.cbl
$ cobc -x student.cbl
$ ./student.cbl

This should execute the (simple) program in question. (Passing the -x flag to cobc tells it to generate an executable, rather than just a library.)

Please let me know if you run into any problems, or have any questions.

Revision history for this message
peter (peter-neuweiler) said :
#5

Hi Adam

Thanks. I'm going to try it and I'll get you a feedback. Thanks.
Peter

Revision history for this message
Adam Buchbinder (adam-buchbinder) said :
#6

One more amendment; the executable created will lack the .cbl extension, so the commands you execute will be:

$ wget http://paste.ubuntu.com/104952/plain/ -O student.cbl
$ cobc -x student.cbl
$ ./student

Sorry about that.

Revision history for this message
rahul kataria (rahulysam) said :
#7

please install Geany in ubuntu for editor ,this is very useful editor for multitype programming language ..
   apt -get install geany
after download
again download cobol
apt-get install open cobol
after installed ......
open geany --> new -->file--->save file name as (file name.cob) and write a program in cobol then save .
open TERMINAL
write the command: cobc -x -free filename.cob (ENTER)
                                           ./filename

OUTPUT is HERE

Revision history for this message
Simon Sobisch (simonsobisch) said :
#8

If you want a nice IDE which you can use with GnuCOBOL (formerly OpenCOBOL) I highly suggest to try the OpenCobolIDE. You can use `dpkg` to install the most current version:

* visit https://launchpad.net/cobcide/+download to get the URL of the latest version
* do the following (using the most current name)
~~~~
cd /tmp
wget https://launchpad.net/cobcide/4.0/4.7.3/+download/python3-opencobolide_4.7.3-1_all.deb
sudo apt-get install open-cobol python3-pyqt5 # these are the dependencies for OCIDE
sudo dpkg -i python3-opencobolide_4.7.3-1_all.deb
~~~~

remark: I've never done this but I *think* it should work