HOME

TheInfoList



OR:

GnuCOBOL (formerly OpenCOBOL, and for a short time known as GNU Cobol) is a free implementation of the
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily us ...
programming language. GnuCOBOL is a
transcompiler A source-to-source translator, source-to-source compiler (S2S compiler), transcompiler, or transpiler is a type of translator that takes the source code of a program written in a programming language as its input and produces an equivalent so ...
to C which uses a native
C compiler This page is intended to list all current compilers, compiler generators, interpreters, translators, tool foundations, assemblers, automatable command line interfaces ( shells), etc. Ada Compilers ALGOL 60 compilers ALGOL 68 compilers cf. ...
. Originally designed by Keisuke Nishida, lead development was taken up by Roger While. The most recent developments are now led by Simon Sobisch, Ron Norman, Edward Hart, Sergey Kashyrin and many others.


History

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 27 December 2007. Work on the OpenCOBOL 1.1 pre-release continued until February 2009. In May 2012, active development was moved to
SourceForge SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirrorin ...
, and the pre-release of February 2009 was marked as a release. In late September 2013, OpenCOBOL was accepted as a
GNU Project The GNU Project () is a free software, mass collaboration project announced by Richard Stallman on September 27, 1983. Its goal is to give computer users freedom and control in their use of their computers and computing devices by collaborati ...
, renamed to GNU Cobol, and then finally to GnuCOBOL in September 2014. Ron Norman has added a Report Writer module as a branch of GnuCobol 2.0, and Sergey Kashyrin has developed a version that uses
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
intermediates instead of C. Latest current release is now v3.1 Final, issued 7 July 2020. Transfer of copyrights to the
Free Software Foundation The Free Software Foundation (FSF) is a 501(c)#501(c)(3), 501(c)(3) non-profit organization founded by Richard Stallman on October 4, 1985, to support the free software movement, with the organization's preference for software being distributed ...
over GnuCOBOL source code (including versions with GNU Cobol and OpenCOBOL spellings) was finalized on 17 June 2015.


Philosophy

While striving to keep in line with COBOL Standards up to the current COBOL 2014 specification, and also to include features common in existing compilers, the developers do not claim any level of standards conformance. Even so, the 2.2 Final release passes over 9,688 (99.79%) of the tests included in the
NIST The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical sci ...
COBOL 85 test suite, out of 9,708 (as 20 are deleted). GnuCOBOL translates a
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily us ...
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 Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
and similar operating systems (such as
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
) the
GNU C compiler The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software ...
is used. For
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
, Microsoft’s
Visual Studio Express Microsoft Visual Studio Express is a set of integrated development environments (IDEs) that Microsoft developed and released free of charge. They are function-limited version of the non-free Visual Studio and require mandatory registration. Exp ...
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.


Documentation

The opencobol.org site was the official home of the development team from 2002 until 2012, and was the best source of upstream development information. However, all recent developments are now taking place within a SourceForge project space a
GnuCOBOL
The GnuCOBOL Programmer's Guide, by Gary Cutler, was published under the
GNU Free Documentation License The GNU Free Documentation License (GNU FDL or simply GFDL) is a copyleft license for free documentation, designed by the Free Software Foundation (FSF) for the GNU Project. It is similar to the GNU General Public License, giving readers the r ...
. It has been updated to include GnuCOBOL with Report Writer and is listed in the GnuCOBOL documentation overview page with latest versions in the code tree. It is maintained by Vincent Coen, James K. Lowden and others as each new compiler version is issued and is available a
GnuCOBOL - GNU Project


Example programs


Historical

000100* HELLO.COB GnuCOBOL 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, free format

*> GnuCOBOL Hello World example id division. program-id. hello. procedure division. display "Hello, world!" end-display goback. Compilation and execution: $ cobc -x -free hello.cob $ ./hello Hello, world!


Shortest

The shortest valid COBOL program, with the relaxed syntax option in GnuCOBOL 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 of GnuCOBOL, GNU Cobol or OpenCOBOL. (Note, there are 7 leading spaces to conform to FIXED layout COBOL source): program-id.h.procedure division.display "Hello, world!". Compilation occurs without errors: $ cobc -x smallest.cob $ ./smallest Hello, world! ''Please note that these trivia listings are not to be regarded as good COBOL form; COBOL was designed to be a readable English programming language.''


Implementation

The parser and lexical scanner use
Bison Bison are large bovines in the genus ''Bison'' (Greek: "wild ox" (bison)) within the tribe Bovini. Two extant and numerous extinct species are recognised. Of the two surviving species, the American bison, ''B. bison'', found only in North Ame ...
and
Flex Flex or FLEX may refer to: Computing * Flex (language), developed by Alan Kay * FLEX (operating system), a single-tasking operating system for the Motorola 6800 * FlexOS, an operating system developed by Digital Research * FLEX (protocol), a comm ...
. The
GPL The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general u ...
licensed compiler and
LGPL The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
licensed run-time libraries are written in C and use the C ABI for external program linkage. Build packaging uses the
GNU Build System The GNU Autotools, also known as the GNU Build System, is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems. It can be difficult to make a software program portable: the C compiler ...
. Standard tests with make check use
Autoconf GNU Autoconf is a tool for producing configure scripts for building, installing, and packaging software on computer systems where a Bourne shell is available. Autoconf is agnostic about the programming languages used, but it is often used for ...
, ANSI85 testsuite run by make test use
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
scripts. The
configure script A configure script is an executable script designed to aid in developing a program to be run on a wide number of different computers. It matches the libraries on the user's computer, with those required by the program before compiling it from its ...
that sets up the GnuCOBOL compile has options that include: * choice of C compiler and its options for post translation compilation * database management system for
ISAM ISAM (an acronym for indexed sequential access method) is a method for creating, maintaining, and manipulating computer files of data so that records can be retrieved sequentially or randomly by one or more keys. Indexes of key fields are mainta ...
support * inclusion of iconv


Availability

*1.0 release from SourceForge. *1.1 release from SourceForge GnuCOBOL downloads at SourceForge *2.0 development release from SourceForge GnuCOBOL downloads at SourceForge *open-cobol
Debian Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
package. *2.2 Final, released 7 September 2017 from SourceForge GnuCOBOL downloads at SourceForge *2.2 Documentation, released September 2017 from the SourceForge Code Tree. *3.1 Released July 2020 along with the documentation.


References


External links


GNU site, official releases of GnuCOBOL
*
Open Source COBOL Consortium in JapanGnuCOBOL FAQAdd1ToCOBOL Open Source Cobol and OpenCOBOL advocacy site
*
New COBOL Users Group
{{DEFAULTSORT:Gnucobol COBOL Compilers Free compilers and interpreters GNU Project software