Posts tagged "Cobol on Linux"

Cobol on Linux OpenSUSE Leap

Installation of Cobol on OpenSUSE Leap

Cobol on LinuxI recently decided to install Cobol on my OpenSUSE Leap 42.3 Linux system.

Cobol is one of the oldest high-level languages, but is still used and regularly updated with the latest software engineering developments such as Object Oriented Programming. It is the language that powers up many important business application around the world.

The development of a Cobol compiler on Linux started in 2001 with a project by Keisuke Nishida and Roger While called OpenCobol,.  OpenCOBOL 1.1  that was accepted and dubbed a GNU package by Dr. Richard Stallman and became GnuCobol 1.1 in 2013 (the Official releases can be found at ftp://ftp.gnu.org/gnu/gnucobol)

A programmer’s guide, by Gary Cutler, and other documentation, can be found at http://open-cobol.sourceforge.net/

Notice that there are other Cobol compilers on Linux and one of the best know is the Micro Focus Cobol, but the GNU Cobol is the only free product. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the FSF (Free Software Foundation).

GnuCobol implements a substantial part of the COBOL 85, COBOL 2002, and COBOL 2014 standards, as well as many extensions of the existent COBOL compilers such as MicroFocus, IBM, MVS, ACUCOBOL-GT, RM/COBOL, BS2000..

GnuCobol  translates COBOL into C and compiles the translated code using the configured C compiler, usually gcc. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, Microsoft Windows, OS/400, z/OS 390 mainframes, among others.

Moreover GnuCobol provides EXEC SQL preprocessors for PostgreSQL, Firebird, ODBC, DB2.
GnuCOBOL 1.1, the current official release version has been built on

  • MS Windows native
  • MS Windows with Cygwin
  • GNU/Linux
  • POSIX Systems including OpenSolaris
  • OS/X
  • AS/400
  • HP Integrity HPUX 11.23
  • RS600 AIX 5
  • 390 Mainframe z/OS OMVS/USS
  • others, Raspberry Pi (quote was $35 for hardware, OS and GnuCOBOL)

There are also a few IDEs meant to support the development of programs written in GnuCobol and among them I found OpenCobolIDE written in Python and the Cobol Development Environment plugin for Eclise.

I tried to install all of them and you will find below a description of their installation.

Installation of GnuCobol  2.2.0

GnuCobolOpenSUSE does not provide gnucobol among its standard installation packages, but provides a link. for a quick installation of gnucobol by using yast2.

It displays a page where you must choose the version of OpenSUSE Leap or Tumbleweed that you are using, it warns you that the packages may be unstable (i.e. with experimental software) and then  offers you 1-click Install options.

If you continue it will show you the additional repositories to be used and they will ask you to accept the installation of the library libcob4 and of gnucobol.

At the end I could find in the /usr/bin library  the commands cobc, cob-config and .cobcrun. I could find also the new directories /usr/lib64/gnucobol and /usr/share/gnucobol

I tried to compile a small hello.cob source file, but I got the following runtime error:

/usr/include/libcob.h:25:17: fatal error: gmp.h: No such file or directory

I checked the usr/include library and actually the libcob.h file was missing.
Since the documentation says that this file is linked to gmp, I decided to install also the gmp package and the libcob-devel package that had not been installed before.

Finally I was able to compile and execute successfully my test cobol program:

linux-wgqh:/home/Mario1/Documents/Cobol/gnucobol # ls
hello hello.cob
linux-wgqh:/home/Mario1/Documents/Cobol/gnucobol # ./hello
Hello, world

Installation of the OpenCobolIDE-4.7.6

OpenCobolIDE  is a simple and lightweight COBOL IDE for the GnuCOBOL compiler.
The software is written in Python using PyQt5 (or PyQt4) and pyQode.

I decided to install this as well and I did it with the following command:

linux-wgqh:/usr/local/resources/mydata/myRPMs # pip3 install OpenCobolIDE –upgrade
Collecting OpenCobolIDE
Downloading OpenCobolIDE-4.7.6.tar.gz (12.9MB)
100% |????????????????????????????????| 12.9MB 20kB/s
Installing collected packages: OpenCobolIDE
Running setup.py install for OpenCobolIDE
Successfully installed OpenCobolIDE-4.7.6

The installation completed successfully, but ,when I tried to run it, I got a long list of errors as follows:

linux-wgqh:/home/Mario1 # opencobolide
Traceback (most recent call last):
File “/usr/lib/python3.4/site-packages/open_cobol_ide/extlibs/pyqode/qt/__init__.py”, line 109, in autodetect
import PyQt5
ImportError: No module named ‘PyQt5’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.4/site-packages/open_cobol_ide/extlibs/pyqode/qt/__init__.py”, line 116, in autodetect
import PyQt4
ImportError: No module named ‘PyQt4’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.4/site-packages/open_cobol_ide/extlibs/pyqode/qt/__init__.py”, line 122, in autodetect
import PySide
ImportError: No module named ‘PySide’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/bin/opencobolide”, line 9, in <module>
load_entry_point(‘OpenCobolIDE==4.7.6’, ‘gui_scripts’, ‘opencobolide’)()
File “/usr/lib/python3.4/site-packages/open_cobol_ide/main.py”, line 29, in main
from pyqode.qt import QtGui
File “/usr/lib/python3.4/site-packages/open_cobol_ide/extlibs/pyqode/qt/__init__.py”, line 156, in <module>
autodetect()
File “/usr/lib/python3.4/site-packages/open_cobol_ide/extlibs/pyqode/qt/__init__.py”, line 126, in autodetect
raise PythonQtError(‘No Qt bindings could be found’)
pyqode.qt.PythonQtError: No Qt bindings could be found

There was obviously something missing and I tried to add to my OpnenSUSE installation also the python3-qt5 package  that I had not installed before, but that I saw mentioned in the article “3 open source projects for modern Cobol development”.

I then re-installed OpenSourceIDE with the command pip3 install OpenCobolIDE –upgrade.

This time the IDE seemed to work correctly, even if it produced the message:

Failed to find a working GNU Compiler

I noticed that there was a Preferences option in the IDE and I requested to use the defaults,
The error disappeared after my successful re-installation of gnucobol and now the IDE is fully working.

Installation of the Cobol Development Environment Plugin for Eclipse

I decided to check also this Cobol IDE for Eclipse.

First I installed eclipse by following the approach suggested in the article  Install Eclipse IDE on OpenSuse Leap 42

The installation took a while to complete, but worked perfectly without any special problem.

I found the Cobol Development Environment Plugin in the Eclipse Marketplace that can be found as an option in the Help menu of Eclipse.  I chose the Cobol Development Environment  0.1.4 solution and tied the Install button.
The installation started, but it soon stopped with the message:

No repository found at https://github.com/bastie/CODE/tree/master/UpdateSite.

It looks like the installation of this this product has not been updated for a while and the marketplace installation currently is not up to date.

It is something that I’m going to investigate in the future.

A Video on Using Cobol on Linux

References

Introduction to GNU Cobol (formerly OpenCobol)

Gnu Cobol (Formerly OpenCobol) by Sourceforge
OpenCobolIDE Documentation
GNU Cobol FAQ
GNU Cobol Manual
3 Open Source Projects for Modern Cobol Development

Be the first to comment - What do you think?
Posted by Mario1 - 28/02/2018 at 5:24 pm

Categories: Computer Languages   Tags:

Cobol Installation on OpenSuSE Linux – My Experience

Cobol Installation on OpenSuSE Linux

Cobol Helps me Perform Tshirt

Cobol Helps me Perform Tshirt (Photo credit: psmithson)

I recently decided to install Cobol on my OpenSuSE Linus system and I decided to consider a few possibilities as follows:

  • Cobol-IT. It is a product distributed freely by  a French company with the same name that seems to be a re-packaging of OpenCobol
  • GNU Cobol (formerly OpenCobol) – An open source Cobol compiler that satisfies the standard 85 and included also some featues of the new standard 2002.

There are also other possibilities listed in the cobug website under the title COBOL Unix and Linux COBOL Compilers, but I decided to concentrate on the three alternatives listed above.

COBOL-iT Installation

Cobol-it provides various products described in the web page http://www.cobol-it.com/index.php?page=products. The COBOL-IT Compiler Suite Community Edition that includes the source code, and build scripts for the Community Edition of the COBOL-IT compiler, runtime, and debugger. can be downloaded from http://www.community.cobol-it.com/

I downloaded the zip file, unzipped and tried the installation as described by the instructions in the INSTALL file, but the make command failed with a compilation error in the file fileio.c.

 

GNU Cobol/OpenCobol Installation

I tried to install OpenCobol from an RPM file that can be downloaded from http://rpm.pbone.net/index.php3?stat=3&search=open-cobol&srodzaj=3&dist[]=46. I made a few attempts because it needed some components that could not be found on my system such as libcob and finally I gave up when I had a message nothing provides gmp >= 4.1.4 needed by open-cobol-1.1-29.112.i586 (even if I had installed gmp from Yast),

I must say that the RPM file is pretty old and made for older versions of OpenSuSE.

I found also a tar installation file that can be downloaded from http://sourceforge.net/projects/open-cobol/,

I downloaded the tar.gz file and extracted its content called gnu-cobol-1.1 that contains also a README file with the installation instructions.

The installation requires the commands:

./configure

make

make check-

make install

I had some problems in the configuration because the Berkeley DB version that I had installed was not compatible. I used YAST2 to install the libdb-4_5-devel and then everything could run without problems.

The  make check  command runs a series of GNU Cobol test programs that produced a successful result.

Most executables are moved by the make install command into the /usr/local/lib directory.

Interestingly the README file mentions the need to have gmp installed, but the problems encountered with the RPM installation did not happen in this installation.

After the installation a found some good manuals on GNU Cobol such as  http://opencobol.add1tocobol.com/OpenCOBOL%20Programmers%20Guide.pdf and http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_1#content_1_0

 

MicroFocus VisualCobol Installation

Microfocus requires a registration on the VisualCobol Personal Edition Download  page and then they send an email with a download link and some details about the installation.

The edition for Unix/Linux is the Visual Cobol for Eclipse and the download file is a setup program that installs Eclipse as part of the product installation.

When you invoke the setup program it displays the following message

Micro Focus Product – Standalone Installer

www.microfocus.com

I had to wait a long time before anything else happened and I suspected that something was wrong, but then I realised that the system was just busy downloaded the installation files

I had also a Warning message copied below:

WARNING – Problem updating /opt/microfocus/VisualCOBOL/etc/cobopt

 

The version of gcc installed on this machine does not match the

version this product was built or compatibility tested with.

Supported versions :

/usr/lib64/gcc/x86_64-suse-linux/4.1.2/32

/usr/lib64/gcc/x86_64-suse-linux/4.3/32

/usr/lib/gcc/i586-suse-linux/4.3

/usr/lib/gcc/i586-suse-linux/4.4

/usr/lib/gcc/i586-suse-linux/4.4/32

/usr/lib64/gcc/x86_64-suse-linux/4.1.2

/usr/lib64/gcc/x86_64-suse-linux/4.3

/usr/lib/gcc/i586-suse-linux/4.3

/usr/lib/gcc/i586-suse-linux/4.4

 

I guess that this was due to the fact that I use openSuSE instead of the SuSE distributions.

 

The installation completed with the following messages:

 

Extracting Eclipse.

 

To configure SOA support in Micro Focus Visual COBOL for Eclipse 2.2 run

$COBDIR/bin/casperm.sh

 

-=-==================================================================-=-

Micro Focus Visual COBOL for Eclipse 2.2

Installation Complete.

-=-==================================================================-=-

 

To use this version of :

Micro Focus Visual COBOL for Eclipse 2.2

 

Run “cobsetenv” to set your environment.

. /opt/microfocus/VisualCOBOL/bin/cobsetenv

 

I started the system with the command ‘eclipse’ and everything seems to work correctly.

 

References

COBOL Unix and Linux COBOL Compilers

COBOL-IT Download Page

Introduction to GNU Cobol

GNU Cobol Download

OpenCobol website

Visual Cobol Personal Edition Download

Visual Cobol Blog

 

 

Enhanced by Zemanta

2 comments - What do you think?
Posted by Mario1 - 08/04/2014 at 2:02 pm

Categories: Computer Languages, Linux Sofware   Tags: