Hi.
If you can change Linux distributions, see post #7 http://www.unix.com/programming/151366-cobol-compiler-suse.html\#post302484450
However, as verdepollo writes, open-cobol can be compiled and installed. To test this, I installed it on CentOS and tested it with:
#!/usr/bin/env bash
# @(#) s1 Demonstrate COBOL compile and execute.
# Section 1, setup, pre-solution.
# Infrastructure details, environment, commands for forum posts.
# Uncomment export command to test script as external user.
# export PATH="/usr/local/bin:/usr/bin:/bin"
set +o nounset
pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
C=$HOME/bin/context && [ -f $C ] && . $C specimen cobc
set -o nounset
pe
# FILE=${1-data1}
FILE=${1-hello,world.cobol}
# Section 2, display input file.
# Display sample of data file, with head & tail as a last resort.
pe " || start [ first:middle:last ]"
specimen $FILE \
|| { pe "(head/tail)"; head -n 5 $FILE; pe " ||"; tail -n 5 $FILE; }
pe " || end"
# Section 3, solution.
pl " Results:"
set +o nounset
if [ -n "$LD_LIBRARY_PATH" ]
then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH /usr/local/lib"
else
export LD_LIBRARY_PATH="/usr/local/lib"
fi
pe " (debug cobol install: COBOL is $(whereis cobc))"
pe " (debug cobol install: LD_LIBRARY_PATH is :$LD_LIBRARY_PATH:)"
cobc -x -free hello,world.cobol
./hello,world
exit 0
producing:
$ ./s1
Environment: LC_ALL = C, LANG = en_US.UTF-8
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.18-194.26.1.el5, i686
Distribution : CentOS release 5.5 (Final)
GNU bash 3.2.25
specimen (local) 1.17
cobc (OpenCOBOL) 1.0.0
|| start [ first:middle:last ]
Whole: 5:0:5 of 6 lines in file "hello,world.cobol"
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
MAIN.
DISPLAY 'Hello, world from open-cobol.'.
STOP RUN.
|| end
-----
Results:
(debug cobol install: COBOL is cobc: /usr/local/bin/cobc)
(debug cobol install: LD_LIBRARY_PATH is :/usr/local/lib:)
Hello, world from open-cobol.
The CentOS 5.5 is the free version of RHEL 5.5.
The install went smoothly, they provided more than 150 tests -- all passed.
There is another COBOL at SourceForge, TinyCOBOL. It appears to be more recently modified, but I could not get it installed (I only tried briefly).
Good luck ... cheers, drl