GNU Cobol

From Wikipedia, the free encyclopedia
  (Redirected from OpenCOBOL)
Jump to: navigation, search
GNU Cobol
Original author(s) Keisuke Nishida, Roger While
Developer(s) Sergey Kashyrin, Ron Norman, Simon Sobisch
Initial release January 25, 2002 (2002-01-25)
Stable release OpenCOBOL 1.1, GNU Cobol 1.1 / February 24, 2009; 5 years ago (2009-02-24)
Preview release GNU Cobol 2.1 / September 27, 2013; 11 months ago (2013-09-27)
Development status Stable
Written in C
Operating system POSIX
Platform Cross-platform
Size 1 MB
Available in English, Japanese
Type Programming Language
License GPL with runtime libraries under LGPL.
Website http://opencobol.org

GNU Cobol (formerly OpenCOBOL) is a free implementation of the COBOL programming language. Originally designed by Keisuke Nishida, lead development was taken up by Roger While. Latest developments are now led by Simon Sobisch, Sergey Kashyrin and Ron Norman.[1]

History[edit]

While working with Rildo Pragana on TinyCOBOL, Keisuke decided to attempt a COBOL compiler suitable for integration with gcc. This soon became the OpenCOBOL project. Keisuke worked as the lead developer until 2005 and version 0.31. Roger then took over as lead and released OpenCOBOL 1.0 on December 27, 2007. Work on the OpenCOBOL 1.1 pre-release continued until February 2009. In May 2012, active development was moved to SourceForge, and the pre-release of February 2009 was marked as a release.[2] In late September 2013, OpenCOBOL was accepted as a GNU project and renamed to GNU Cobol.[3] Ron Norman has added a Report Writer module as part of GNU Cobol 2.1, and Sergey Kashyrin has developed a version that uses C++ intermediates instead of C.[4]

Philosophy[edit]

While striving to keep in line with COBOL Standards up to the 20xx Draft, and also to include features common in existing compilers, the developers do not claim any level of standards conformance.[5] Even so, the 1.1 release candidate passes over 9,000 of the tests included in the NIST COBOL 85 test suite.[6]

GNU Cobol translates a COBOL program (source code) into a C program. The C program can then be compiled into the actual code used by the computer (object code) or into a library where other programs can call (link to) it. Under UNIX and similar operating systems (such as Linux) the GNU C compiler is used. For Windows, Microsoft’s Visual Studio Express package provides the C compiler. The two step compilation is usually performed by a single command, but an option exists to allow the programmer to stop compilation after the C code has been generated.[7]

Documentation[edit]

The "Opencobol.org" site was the official home of the development team, and was considered the best source for the latest upstream development information.[8] However, all recent developments are now taking place within a SourceForge project space at http://sourceforge.net/projects/open-cobol/ and this project space will house the latest documentation and information.

The OpenCOBOL Programmer's Guide, by Gary Cutler, has been published under the GNU Free Documentation License.[7]

Example programs[edit]

Historical[edit]

 000100* HELLO.COB GNU Cobol FAQ example
 000200 IDENTIFICATION DIVISION.
 000300 PROGRAM-ID. hello.
 000400 PROCEDURE DIVISION.
 000500     DISPLAY "Hello, world!".
 000600     STOP RUN.

Compilation and execution:

$ cobc -x HELLO.COB
$ ./HELLO
Hello, world!

Modern[edit]

 *> GNU Cobol Hello World example
 identification division.
 program-id. hello.
 procedure division.
 display "Hello, world!" 
 end-display
 goback.

Compilation and execution:

$ cobc -x -free hello.cob
$ ./hello
Hello, world!

Shortest[edit]

The shortest valid COBOL program with the relaxed syntax option in OpenCOBOL 2.0 is a blank file. Compilation and execution:

$ cobc -x -frelax-syntax ./empty.cob
./empty.cob: 1: Warning: PROGRAM-ID header missing - assumed
$ ./empty
$ 

For earlier versions and with relaxed syntax:

display"Hello, world!".

Compilation and execution:

$ cobc -x -frelax-syntax -free hello.cob
hello.cob: 1: Warning: PROGRAM-ID header missing - assumed
hello.cob: 1: Warning: PROCEDURE DIVISION header missing - assumed
$ ./hello
Hello, world!

Without relaxed syntax and with any version (NB note the leading 7 spaces):

       program-id.h.procedure division.display "Hello, world!".

Compilation occurs without errors:

$ cobc -x smallest.cob
$ ./smallest
Hello, world!

Implementation[edit]

The parser and lexical scanner use Bison and Flex. The GPL licensed compiler and LGPL licensed run-time libraries are written in C and use the C ABI for external program linkage.

Build packaging uses the GNU build system. Compiler tests for make check use Perl scripts.

The configure script that sets up the OpenCOBOL compile has options that include:

  • choice of C compiler for post translation compilation
  • database management system for ISAM support
  • inclusion of iconv

Availability[edit]

  • 1.0 release from SourceForge.[9]
  • 1.1 release from SourceForge[10]
  • Open-cobol Debian package.[11]

References[edit]

  1. ^ Tiffin, Brian (2013-10-19). "What is the development history of OpenCOBOL?". OpenCOBOL FAQ. Retrieved 2013-12-13. 
  2. ^ Tiffin, Brian (2013-10-19). "What is the current version of OpenCOBOL?". OpenCOBOL FAQ. Retrieved 2013-12-13. 
  3. ^ Tiffin, Brian. "GNU Cobol is now a real thing". Retrieved 1 October 2013. [dead link]
  4. ^ Sobisch, Simon (6 November 2013). "GNU Cobol 2.0 C++". Work in Progress. 
  5. ^ "How complete is OpenCOBOL?". OpenCOBOL FAQ. 17 October 2013. Retrieved 7 June 2014. "While OpenCOBOL can be held to a high standard of quality and robustness, the authors DO NOT claim it to be a “Standard Conforming” implementation of COBOL." 
  6. ^ "Does OpenCOBOL pass the NIST Test Suite?". OpenCOBOL FAQ. Retrieved 9 October 2013. 
  7. ^ a b Cutler, Gary. "OpenCOBOL Programmer's Guide". Opencobol.addltocobol.com. Retrieved 2012-11-20. 
  8. ^ "An open-source COBOL compiler". OpenCOBOL. Retrieved 2012-11-20. 
  9. ^ "OpenCOBOL - Browse Files at". Sourceforge.net. 2007-12-27. Retrieved 2012-11-20. 
  10. ^ Community Edition at SourceForge
  11. ^ Debian package details

External links[edit]