OpenCOBOL

From Wikipedia, the free encyclopedia
Jump to: navigation, search
OpenCOBOL
Original author(s) Keisuke Nishida
Developer(s) Roger While
Initial release January 25, 2002 (2002-01-25)
Stable release OpenCOBOL 1.1 / February 24, 2009; 4 years ago (2009-02-24)
Preview release OpenCOBOL 1.1CE / October 26, 2012; 7 months ago (2012-10-26)
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

OpenCOBOL, is a freely available open source implementation of the COBOL programming language. Originally designed by Keisuke Nishida, the lead developer is now Roger While.

Contents

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 up till 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 candidate.

Philosophy[edit]

While striving to keep inline with COBOL Standards up to the 20xx Draft, and to include features common in existent compilers, (the 1.1 release candidate passes over 9,000 of the tests included in the NIST COBOL 85 test suite),[1] there is no claim to any level of standards conformance.

OpenCOBOL translates COBOL source code to intermediate C, which is then compiled to native binary for execution, or as object code or into a dynamic library for linkage.

Documentation[edit]

Opencobol.org[2] is always the most up-to-date upstream development information.

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

Hello OpenCOBOL[edit]

Historical[edit]

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

Modern[edit]

*> OpenCOBOL Hello World example
identification division.
program-id. hello.
procedure division.
display "Hello World!" end-display
goback.

Shortest[edit]

program-id.h.procedure division.display"Hello World!".

Compile and execute[edit]

For the Historical example

$ cobc -x HELLO.COB
$ ./HELLO
Hello World!

cobc defaults to FIXED FORMAT translation. The FREE FORMAT (either the Modern or Shortest) can be compiled with

$ cobc -x -free hello.cob
$ ./hello
Hello World!

relax-syntax[edit]

If relaxed syntax is used, the shortest Hello World program can actually be

display"Hello World!".

with a compile example of

$ 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!

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.[4]
  • 1.1 release from SourceForge[5]
  • Open-cobol Debian package.[6]

References[edit]

  1. ^ OpenCOBOL NIST COBOL85 test results
  2. ^ "An open-source COBOL compiler". OpenCOBOL. Retrieved 2012-11-20. 
  3. ^ "OpenCOBOL Programmer's Guide". Opencobol.addltocobol.com. Retrieved 2012-11-20. 
  4. ^ "OpenCOBOL - Browse Files at". Sourceforge.net. 2007-12-27. Retrieved 2012-11-20. 
  5. ^ Community Edition at SourceForge
  6. ^ Debian package details

External links[edit]