GnuCOBOL

 

What is GnuCOBOL?  GnuCOBOL (formerly OpenCOBOL) is a free COBOL compiler that may be utilized on Windows or Linux platforms.  Complete documentation, with instructions for downloading and installing it are available at https://sourceforge.net/projects/open-cobol/.  A very informative Frequently Asked Questions document lives at https://opencobol.add1tocobol.com/gnucobol/

I am not personally involved in the development of GnuCOBOL.  So why would I go to the trouble of creating this page?  Well, in 2013 Brian Tiffin, who is involved in the development of GnuCOBOL, contacted me because of my Report Writer tutorial in the Hercules section of this site.  Specifically, a member of their development team had been working to implement Report Writer in GnuCOBOL and had been utilizing my sample programs to test/verify their implementation of Report Writer.  We exchanged several emails and I was pleased that he wanted to include links to my tutorial in their project, which I of course was happy to allow permission for.  At that time I was still using Windows (XP, and then later upgraded to 7 when forced to, along with many others when XP went out of support).  So, even though GnuCOBOL was available for Windows, at that time I just didn't have the necessity to investigate it further.

Fast forward to the first of 2016 (a few months ago as I write this) and I have finally dumped Windows (again, and for the last time I believe) and have returned to running Linux on all of the computers on my network.  After the dust settled from the switchover of the first three of my desktops, I decided on a slow Sunday afternoon to go in search of GnuCOBOL.  This was not simply a way to pass a mostly idle Sunday afternoon, as I needed a way to transport some programs that I had previously been maintaining on Windows in Microsoft COBOL (a very old rebranded version of MicroFocus COBOL) over to Linux Mint 17.3.  It was a very easy process getting GnuCOBOL installed on my system, although the only version available in the repositories for Linux Mint is 1.1, which does not include the Report Writer feature.  The programs I was immediately interested in using GnuCOBOL for compiled with almost no modifications required.  Of course I wanted to see how my Report Writer sample programs would fare under GnuCOBOL, so I went back and researched how to get a later (pre-release 2.0) version of GnuCOBOL that included the Report Writer features.  And yes, every Report Writer program I have tried compiled with GnuCOBOL and executed flawlessly.

I continue to expand my experience with GnuCOBOL and find that it is a very robust compiler.  It implements all the standard features of the older COBOL compilers I had been using, plus adds an impressive number of extensions to 'standard' COBOL syntax that makes it a very positive addition to my Linux desktop environment.  I have used REXX for most of my scripting needs for a long time, and must say that GnuCOBOL can be used to implement many, if not all, of the same types of scripting solutions that I would normally use REXX for. In fact, I can see that in the future it will be a toss-up whether I choose REXX or COBOL when I need to write a script for one of my Linux desktops.  COBOL was the second computer language I ever learned (and I never was that proficient in FORTRAN, the first language), so I am delighted to find how often I am now coding COBOL again for every day tasks at one of my computers.

Anyway, the reason for this page is to share some of the programs I have recently resurrected by transferring them from other, older COBOL compilers or algorithms that I have converted from other languages to COBOL now that I have GnuCOBOL available.  Any of the programs I have placed here are free to be used in any way anyone might find advantageous, as they are or in derivative work.  I would appreciate if you leave some acknowledgement of my authorship of the originating concept if you further distribute the source code.  If you find errors I would appreciate you notifying me so that I may correct them.


My GnuCOBOL Programs

 

I can't really see how this collection will ever be able to have any formal structure or organization.  Also, because of the nature of the programs, I believe any of the programs (or individual small collection of programs, as the case may be) will only require a minimal amount of documentation; really just enough to assist anyone interested in downloading the source and whatever special instructions are necessary for customizing and compiling.  This is an index of the programs available here and link to a separate page for each program (or collection of programs).

Y2K Date Routines These are the routines I consolidated in the final years of the 1990s from a number of date algorithms I had written over the previous decades (in BASIC, COBOL, and assembler).  I was recently going through some old archives, looking for a program I wrote in 1986 and compiled only with Ryan-McFarland COBOL and was shocked to find that I had translated some of them to Microsoft Assembler (in 1993), which I totally do not remember doing.  If you are familiar with my Hercules' pages, you may recognize that these have all been translated as closely as possible from the 370 Assembler versions.
Elapsed This program will accept one or two dates from the command line and display the number of years, months, days between the two dates. * Updated April 22, 2021 *
Currency-to-Words This program will accept a numeric value and return the corresponding value stated in words (commonly used when printing checks to thwart modification fraud).
Timeline This program produces a timeline report showing relationships between people and events.
ParseCSV This program will parse a buffer passed by the calling program and return discrete fields. * Updated May 31, 2022 *
Base36 A couple of subprograms that will convert numeric values between Base 10 and Base 36 representation.
c wrapper Not COBOL, but a C wrapper for a library function I needed to call from a GnuCOBOL main program.
parseKWsets This program will parse a buffer containing a keyword and value into discrete fields. * Updated September 20, 2019 *
Vaccine Calendar Prints calendar for vaccination of a child from birth to age 18.
Load Music on USB Drive Load Music files (mp3) onto USB drive.
Remove HTML Tags from String Remove all HTML tags from a passed string variable.
Remove Redundant Spaces from String Remove redundant (two or more successive) spaces from a passed string variable.
Report String Statistics Report content statistics for a passed string variable. * Updated September 20, 2019 *
Break String into Words Scan string variable and split into words delimited by space(s). * Updated November 8, 2019 *
copybook utility script Bash script to list or display copybooks.
Break HTML paragraph Scan string variable containing a unit of HTML code and split into words, tag items delimited by < > and non-tag items delimited by spaces.
convert EBCDIC to ASCII Convert character field from EBCDIC to ASCII or ASCII to EBCDIC
ISBN13 check digit Compute check digit for ISBN (International Standard Book Number) or validate the check digit for a given ISBN.

This page was last updated on May 31, 2022.