OpenCOBOL
Encyclopedia
OpenCOBOL, is a freely available open source implementation of the COBOL
COBOL
COBOL is one of the oldest programming languages. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments....

 programming language. Originally designed by Keisuke Nishida, the lead developer is now Roger While.

History

While working with Rildo Pragana on TinyCOBOL, Keisuke decided to attempt a COBOL compiler suitable for integration with gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

. 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 has been in active development ever since.

Philosophy

While striving to keep inline with COBOL Standards up to the 20xx Draft, and to include features common in existent compilers, (the 1.1 pre-release passes over 9,000 of the tests included in the NIST
National Institute of Standards and Technology
The National Institute of Standards and Technology , known between 1901 and 1988 as the National Bureau of Standards , is a measurement standards laboratory, otherwise known as a National Metrological Institute , which is a non-regulatory agency of the United States Department of Commerce...

 COBOL 85 test suite), there is no claim to any level of standards conformance.

OpenCOBOL translates COBOL
COBOL
COBOL is one of the oldest programming languages. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments....

 source code to intermediate C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

, which is then compiled to native binary for execution, or as object code or into a dynamic library for linkage.

Documentation

opencobol.org is always the most up-to-date upstream development information

The very comprehensive, and well written OpenCOBOL Programmer's Guide 3.3Mb by Gary Cutler, has been published under the GNU Free Documentation License
GNU Free Documentation License
The GNU Free Documentation License is a copyleft license for free documentation, designed by the Free Software Foundation for the GNU Project. It is similar to the GNU General Public License, giving readers the rights to copy, redistribute, and modify a work and requires all copies and...

.

Historical

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

Modern

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

Compile and execute

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

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

The parser and lexical scanner use Bison
GNU bison
GNU bison, commonly known as Bison, is a parser generator that is part of the GNU Project. Bison reads a specification of a context-free language, warns about any parsing ambiguities, and generates a parser which reads sequences of tokens and decides whether the sequence conforms to the syntax...

 and Flex
Flex lexical analyser
flex is a free software alternative to lex. It is frequently used with the free Bison parser generator. Unlike Bison, flex is not part of the GNU Project. Flex was written in C by Vern Paxson around 1987...

. The GPL licensed compiler and LGPL licensed run-time libraries are written in C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 and use the C ABI
Application binary interface
In computer software, an application binary interface describes the low-level interface between an application program and the operating system or another application.- Description :...

 for external program linkage.

Build packaging uses the GNU build system
GNU build system
The GNU build system, also known as the Autotools, is a suite of programming tools designed to assist in making source-code packages portable to many Unix-like systems....

. Compiler tests for make check use Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 scripts.

The configure
Configure script (computing)
Developing a program to be run on a wide number of different computers is a complex task. A Configure script matches the libraries on the user's computer, with those required by the program, just before compiling it from its source code....

 script that sets up the OpenCOBOL compile has options that include:
  • choice of C compiler for post translation compilation
  • database management system for ISAM
    ISAM
    ISAM stands for Indexed Sequential Access Method, a method for indexing data for fast retrieval. ISAM was originally developed by IBM for mainframe computers...

     support
  • inclusion of iconv.

Availability

1.0 release from SourceForge.

1.1 pre-release tarball from sim-basis.de.

open-cobol Debian
Debian
Debian is a computer operating system composed of software packages released as free and open source software primarily under the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential...

package.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK