Wednesday, July 15, 2009

Eclipse Cobol Plugin

I've got Cobol training materials started from yesterday until next 5 days from company I'm working for. It's a bit old fashion programming language to learn but I think it's ok to learn something new, just to get to know. It's not pure ordinary Cobol We're going to learn actually, but it's Mincom Cobol, Cobol customized by Mincom.

Because of my curiousity, I googled any sources about ordinary Cobol, I downloaded ebooks about Cobol until I realized that it needs compiler hehehe. Then I realized (again) that it's very difficult to download free Cobol compiler. Some ebooks said that they use Fujitsu but when I went to the link they give, no download links...until I saw a link pointing to 'eclipse cobol plugin from Fujitsu'. Wow... somebody wrote plugins for Cobol? Then I remember that there are either plugins for C or C++ in eclipse hehehe, I'm just so out of date...

Actually this is my very first time using Cobol. This writing is just about telling you how to install Cobol plugin in eclipse, just my notes in case I need it again later. Lets start...

1. Download cobol plugin from eclipse.org. At the moment of writing, I can only install on eclipse 3.4. It didn't work for eclipse 3.2, besides, it's still in beta version. Extract it and put the plugins and features into your eclipse appropriate folders as usual.

2. Download source code open-cobol-1.0, extract it, and then run three magic steps after you're in extracted folder : ./configure, make check, sudo make install. Don't forget to download dependency library if you encounter some errors. On configuration I made yesterday, I encountered two dependency libraries missing which are libgmp3-dev and libdb4.2-dev.

3. Create Cobol command in /opt/FJSVcbl/bin/cobol just like this :

#!/bin/bash
# netCOBOL -> OpenCOBOL
echo " =NetCOBOL>OpenCOBOL: $*"
compiler="/usr/local/bin/cobc"

exefile=""
dolink=true
mainp=""
copylib=""

while getopts ":cMI:o:" optioncode; do
case $optioncode in
c ) dolink=false ;;
M ) mainp="-x" ;;
I ) wOPTARG=${OPTARG%;} ; copylib="-I ${wOPTARG//;/ -I }" ;;
o ) exefile=" -o $OPTARG" ;;
\? ) ;;
esac
done
shift $((OPTIND - 1))

if [ $dolink = false ]; then
command="$compiler $mainp -c $copylib $*"
echo " =Compile: $command"
$command
fi
if [ $dolink = true ]; then
command="$compiler -x $exefile $*"
echo " =Link: $command"
$command
fi
# eof

4. To test, create new Cobol project in eclipse Cobol perspective. If you find error message at console when you build the project, which is permission denied, then do chmod 755 /opt/FJSVcbl/bin/cobol.

5. If it is error "error while loading shared libraries: libcob.so.1: cannot open shared object file: No such file or directory" when you run the project, then do sudo ln -s /usr/local/lib/libcob.so.1 /usr/lib/libcob.so.1.

Reference : http://www.hop-penchan.org/yogawa/tool/opencobol/index.xml

1 comments:

Vecky Novritz said...

Mas Rochmat, Kantor saya sedang menggunakan software ERP dari mincom juga. Saat ini saya menggunakan windows, untuk pekerjaan sehari2nya. Yang ingin saya tanyakan, bagaimana menginstal cobol plugin di eclipse environment windows. sehingga saya bisa mengcompile dan menjalankan aplikasinya melalui ellipse.

Matur Nuwun ya mas.

 

©2009 Stay the Same | by TNB