GNU Cobol FAQ
Total Page:16
File Type:pdf, Size:1020Kb
GNU Cobol FAQ | Status This is a 2.1 work in progress release of the GNU Cobol FAQ. Sourced at gcfaqrrst. Courtesty of ReStructuredText, Sphinx and Pygments. GNU Cobol 2.1 is not currently rolled out, but is available for testing. GNUCobolFAQppdf is also available, but broken, as a work in progress, with no work done yet, using Texlive and Sphinx. This FAQ is more than a FAQ and less than a FAQ. Someday that will change and this document will be split into a GNU Cobol manual and a simplified Frequently Asked Questions file. Website favicon by Mark James, help.png from the FAMFAMFAM Silk icon set. http://creativecommons.org/licenses/by/2.5/ Banner courtesy of the GIMP, Copyright © 2008-2014 Brian Tif- fin licensed under Creative Commons Attribution-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-sa/2.0/ Authors Brian Tiffin [btiffin]_ Answers, quotes and contributions: John Ellis [jrls_swla]_, Vincent Coen, Jim Currey, Bill Klein [wmk- lein]_, Ganymede, Simon Sobisch [human]_, Rildo Pragana, Sergey Kashyrin, Federico Priolo, Frank Swarbrick, Angus, DamonH, Parhs, Gerald Chudyk Compiler by: *Roger While* [Roger]_, *Keisuke Nishida* [Keisuke]_, *Ron Norman* [Ron]_, *Sergey Kashyrin* [Sergey]_, (with the invaluable assistance of many others) Special credits to *Gary Cutler* author of the GNU Cobol Programmers Guide Joseph James Frantz for hosting and advocacy [aoirthoir]_ 1 Version 2.1.17, May 24th, 2014 Status never complete; like a limit, limaq→0 f(aq) = 42 Copyright Copyright © 2008-2014 Brian Tiffin ChangeLog ChangeLog_ note Regarding COBOL Standards, Official COBOL Standards: There are many references to standards in this document. Very few of them are technically correct references. Apologies to all the hard working men and women of the technical committees for this un- intentional slight. For specific details on what wordings should be used please see What are the Official COBOL Standards?_ GNU Cobol _GNU Cobol FAQ What is GNU Cobol? GNU Cobol_ is a free COBOL_ compiler. GNU Cobol is a GNU software project. GNU Cobol implements a substantial part of the COBOL 85_ and COBOL 2002_ standards, as well as many extensions of the existent COBOL compilers. GNU Cobol translates COBOL into C and compiles the translated code using the configured C compiler, usually gcc. You can build your COBOL programs on various platforms, including Unix/Linux, Mac OS X, Microsoft Windows, OS/400, z/OS 390 mainframes, among others.. GNU Cobol was OpenCOBOL. OpenCOBOL started around 2002, and on September 26th, 2013, GNU Cobol was accepted and dubbed a GNU pack- age by Dr. Richard Stallman. One day before the 30th anniversary of the GNU announcement. The official page for GNU Cobol is: http://savannah.gnu.org/projects/gnucobol A valuable reference, the GNU Cobol Programmer's Guide can be found at GNU Cobol Programmers Guide. The original OpenCOBOL Programmer's Guide can be found at OpenCOBOL Programmers Guide. 2 In this author’s opinion, GNU Cobol is a world class COBOL compiler, very capable with almost all of the COBOL 85 specifications, plus having some very internet ready, next generation potentials. As a teaser, here is a GNU Cobol sample, written to explore the desktop GTK calendar widget, redirected to a browser using GDK Broadway, with clicks in the browser window invoking GNU Cobol graphical event callback handlers. More on this in A GTK+ calendar_ What is COBOL? COBOL_ is an acronym for COmmon Business Oriented Language. This author has always thought of it as “Common Business” Oriented more than Common “Business Oriented”, but that emphasis is perhaps up to the reader’s point of view. As an aside: I’d like to steal the O in COmmon, and haven’t found a suitable word as of yet. Common Originally Business Oriented Language, was tried, trying to connote “it’s been extended”, but it sounds diminishing, like GNU Cobol can’t do Business anymore. Which isn’t the case. So, the quest continues. 3 How is GNU Cobol licensed? The compiler is licensed under the GNU General Public License. The run-time library is licensed under GNU Lesser General Public License. All source codes are copyright by the respective authors. With many thanks to Roger While and Keisuke Nishida for sharing their work with the world. What that means, roughly, is: You are allowed to write GNU Cobol programs that use the libcob run time library however you like. Closed, proprietary, commercial use is allowed as part of the GPL user freedoms. You can ship GNU Cobol generated programs in binary form as you wish, (with exceptions; mentioned below). Modifications to the compiler itself, MUST provide access to source code and be licensed under the GNU GPL. Modifications to the run time library code must also provide access to the source code of the library changes, and be licensed under the LGPL. This ensures that no one is allowed to call modified sources their own, nor deny anyone else the chance to copy and re-distribute the compiler source code, including your local changes. Please note: any verion of the compiler that is configured to use Berkeley DB beyond version 1.85 must abide by the Oracle license, and sources of the COBOL programs that use libdb must be shipped with any binaries. There are alternatives to libdb, but deep down, GNU Cobol encourages open and free software. GNU Cobol is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. What platforms are supported by GNU Cobol? OpenCobol 1.0_ the current official release version, hosted on SourceForge.net, compiles on: • All 32-bit MS Windows (95/98/NT/2000/XP) • All POSIX (Linux/BSD/UNIX-like OSes) • OS/X GNU Cobol 1.1_, has been built on 4 • MS Windows native • MS Windows with Cygwin • GNU/Linux • POSIX Systems including OpenSolaris • OS/X • AS/400 • HP Integrity HPUX 11.23 • RS600 AIX 5 • 390 Mainframe z/OS OMVS/USS • others Are there pre-built GNU Cobol packages Yes. Debian_ APT_, and RPM packages exist. Packages for NetBSD. Many. Google opencobol packages for older builds, and gnu cobol for any late breaking news. A Debian Advanced Package Tool binary package exists for GNU Cobol 1.1 as open-cobol and lists dependencies of • libc6 (>= 2.7-1), • libcob1, • libcob1-dev (= 1.0-1), • libdb4.5 (>= 4.5.20-3), • libdb4.5-dev, • libgmp3-dev, • libgmp3c2, • libltdl3-dev, • libncurses5 (>= 5.6+20071006-3) Thanks to the gracious efforts of Bart Martens, bartm on Debian’s .org domain. kiska.net repository Also check out kiskannet for binary builds on various platforms. Thanks to Sergey Kashyrin, who is also the author of the version that emits C++ inter- mediates. sourceforge There are GNU Cobol links at http://cobol.sourceforge.net 5 In particular, http://sourceforge.net/projects/cobol/files/open-cobol/ can come in handy, with sources and MinGW binaries at a minimum. Maybe more as time goes on. Windows ™ MinGW Arnold Trembley put together an INNO installer, based on Gary Cut- ler’s MinGW builds of OpenCOBOL 1.1. Makes it pretty easy to get COBOL running on a PC. You can find it attached to SourceForge discus- sions, or at Arnold’s site, http://www.arnoldtrembley.com/OpenCOBOL-1. 1-06FEB2009-MinGW-Setup.exe What is the most recent version of GNU Cobol? See What is the current version of GNU Cobol?_ How complete is GNU Cobol? OpenCOBOL 1.0_ implements a substantial portion of COBOL 85_, supports many of the advances and clarifications of COBOL 2002_, and includes many extensions in common use from Micro Focus COBOL, ACUCOBOL and other existent compilers. GNU Cobol 2.1_ implements a more substantial portion of the COBOL 85_ Dialect, COBOL 2002_ and a growing number of vendor extensions. Some proposed COBOL 20xx features have also been implemented. Compatibility support includes: • MF for Micro Focus • IBM for IBM compatibility • MVS • BS2000 GNU Cobol also includes some advanced features allowing source code such as CALL "cfunction" USING BY REFERENCE ADDRESS OF VAR-IN-LINKAGE-SECTION. Passing the equivalent of char**, pointer to pointer to char. Just as a small example of the level of coverage and flexibility provided by GNU Cobol. DISPLAY FUNCTION UPPER-CASE( 6 FUNCTION SUBSTITUTE( "This is the orginal string."; "original"; "new"; "string"; "text" ) ) END-DISPLAY To allow for substitution of mixed length strings, something not normally so easy in COBOL. The above will output: THIS IS THE NEW TEXT. note While GNU Cobol 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. Will I be amazed by GNU Cobol? This author believes so. For a free implementation of COBOL, GNU Cobol may surprise you in the depth and breadth of its COBOL feature support, usability and robustness. COBOL has historically been very secretive and low key. Its domain of use being very secretive and low key. COBOL programmers rarely work on systems that would allow for open internet chat regarding details, let alone existence. It is a tribute to the professionalism of these programmers that most people rarely, if ever, hear the name COBOL, a programming language with billions of lines of source code compiled and in production around the world over half a century. GNU Cobol is poised to change that historic trend, and allow for the long overdue sharing of wisdom that legions of COBOL developers have accumulated over 50 years of success and failure.