I have seen the future, and it is COBOL?

LinuxWorld.com –

Let me tell you about a hot Web scripting language. It's been ported to almost every computer architecture ever made; its speed and readability are legendary. It's known to be good with databases. Some people swear by it, some people swear at it, but it's a force to be reckoned with, and it's coming to your desktop. It's COBOL.

I must admit that when this email crossed my desk, I was inclined to think it was a joke. After checking the calendar (no, it wasn't April Fools' Day) and the company's Web site, I was convinced it was real, and I became intrigued with Deskware's CobolScript.

For while the elders of the hacking world have nothing but scorn for COBOL, I'm one of those who grew up reading the Jargon File rather than living it. I must confess now to a secret desire to know what COBOL is like ... to program in APL ... to learn Ada! My Y2K experience has slaked my thirst for this knowledge in small part, but it has (un)fortunately been limited to DEC FORTRAN with light PDP/11 macro assembler. I've had no experience with COBOL.

LinuxWorld.com links LinuxWorld.com home

Best of LinuxWorld.com

The Legacy Files

The Penguin Brief

Version Control

Linux links

Linux forums

So I recognized that this was my big chance to discover the truth of Edsger W. Dijkstra's oft-quoted fortune:

The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense.

COBOL's wordiness is legendary: they say it has more lines of source code than generated machine instructions. Like FORTRAN, it's designed to be read in on 80-column cards. It has a built-in function for calculating the present value of an investment, but no variable scope. Thinking about programming in COBOL gives me the same feeling as thinking about the joke language INTERCAL: entering a world where any minor achievement -- like adding two integers -- has hack value because it is so difficult to do.

Why CobolScript

Not everyone is like me, of course -- most people's interest in COBOL is less frivolous. It may come as a surprise to some of you, but the COBOL market is not small. In fact, Matt Dean, the president and CEO of Deskware, estimates that as many as 2.5 million programmers have primary skills in COBOL. That's a lot of programmer training potentially going to waste in these days of computing languages with beans. A job market as tight as IT is today can't afford to waste that much talent.

COBOL programmers are habitually undervalued by management. The general attitude seems to be that they're old, and expensive: it would be better if they just disappeared. Although COBOL is enjoying a brief resurgence as a result of Y2K conversions (did you expect to see COBOL for Dummies published in your lifetime?) -- it seems obvious that people will go back to their former attitudes about COBOL and COBOL programmers after Y2K work is done.

But language snobbery is silly. To look down at COBOL and COBOL programmers is to be as childish as the "Real VMS Programmers" who to this day look down on Unix and Unix programmers.

Besides, COBOL programmers are not dinosaurs! They may be nearing (or even past) retirement age -- but they are Real Programmers. They are among the first generations of programmers -- those who got into the field because they loved it, and not (like many undergraduates today) because they'd seen people five years older than them retire with $20 million dot-com.

And as they do move into retirement, most COBOL programmers will probably continue to tinker with computers for the love of it, creating a huge pool of idle programming talent. Think of another 2.5 million programmers working on open-source projects: people with extensive systems programming backgrounds, experience on realtime operating systems, and lots of free time. Irrespective of the success of COBOL on Linux, we should try to interest these programmers in Linux as a free operating system to use, modify, and share.

CobolScript allows them to leverage their COBOL skills in a new space, and Deskware is deliberately targeting this group as its primary market, positioning CobolScript as a COBOL-like scripting language with support for Internet protocols.

You want they should use Windows?

Deskware is also targeting mainframe shops that still use COBOL as their primary language. For those shops, getting on the Web may seem prohibitively difficult: they'd have to move to new hardware running new operating systems and new languages. With CobolScript, they have a familiar language, and it will no doubt be easier to port their existing code to the Web server.

Consider the case of a mainframe shop that's going to install a PC as a Web server. If COBOL is the language that its employees are most comfortable with, shouldn't they look for COBOL implementations on the various systems they're considering? CobolScript on Linux makes Linux and other free software solutions (such as Apache or Perl) more appealing.


It's obvious that I'm not a COBOL programmer. But if you are, do please let me know if I have managed to accurately portray the situation regarding COBOL today.

For more and better arguments, you might also want to read the "Why COBOL?" pages at AcuCorp (see Resources). AcuCorp is another company that provides modern support for COBOL (how many of these guys are there?!).

Flame us not!

We know that Deskware and AcuCorp are not the only companies creating modern tools for COBOL! If you send us a brief description and a URL for your favorite COBOL product, we'll list them here in this box for the whole world to see. We looked up a few with Archie to get us all started:

  • AcuCorp changes "legacy" to "leading edge" with its COBOL-extending ACUCOBOL-GT Development Suite. You can access RDBMSs, embed SQL, interface to MS Windows, access the Internet -- and present it all to your users with a beautiful GUI you whipped up in nanoseconds, thanks to AcuCorp's WYSIWYG GUI screen painter. http://www.acucorp.com/Products/
  • Figure out what the heck your COBOL programs are actually doing with automated PowerStructure III flowcharts from CyberMetrics (version 4.0 is coming soon!)

  • You will be writing dynamic cross-platform COBOL programs using powerful technologies such as ORB, CCI, TCP/IP, and plug-and-play networking in no time at all with the Object COBOL Developer Suite for UNIX from Merant.

  • Create client/server applications that furnish fast access to distributed enterprise data -- including most commercial databases -- with Fujitsu COBOL for Unix (also available for Win9x/NT). (Yes, it apparently is that Fujitsu!)

  • Merant's NetExpress, the best selling PC COBOL development tool out there, will also allow you to develop web pages -- not with a COBOL-like tool -- but with good old COBOL. It is available for Unix or (gasp!!) NT.


For me, playing with COBOL is a history lesson: COBOL was the first widely used high-level language for business, and sources say there may be more existing lines of code in COBOL than in any other language (and that isn't only because COBOL is so wordy ...)

The first standard version of COBOL was COBOL-60; it has evolved all the way up to COBOL-85. You can see the levels of revision as old features were rethought and new ones added to the language. While that history lesson is harder to spot in CobolScript than in straight COBOL, you can still see it.

CobolScript, meanwhile, is basically what its name implies -- a COBOL-like scripting language. It's a new implementation based on ANSI85 COBOL, so that old-COBOL arithmetic operations (like

) have been updated to what I'd call a natural-expression syntax:
<font face="Courier">COMPUTE TOTAL-COST = UNIT-COST * COUNT.</font>

Keep in mind that when COBOL was designed, its programmers weren't trying to write the book on the elements of obscurity for generations to come. On the contrary -- COBOL, or COmmon Business Oriented Language -- was an attempt to create a programming language that was easy to use because it was like natural English. The obscurities came about because the programmers were shooting in the dark, and few had ever created a high-level language before. Can the same be said for other languages' obscurities?

Download and installation

CobolScript is available for online purchase from Deskware for $49.95. It runs on Windows 9x/NT, Solaris and FreeBSD -- and Linux, of course. After filling out the online purchase form, you can download the product and install it, either in three parts or as one large tarball. I downloaded the full version, including the interpreter, sample scripts, and manual (about 5 MB). I created a subdirectory for CobolScript and unpacked the distribution into it. Then I unpacked the sample scripts into another subdirectory:

<font face="Courier">
$ cd /usr/local/bin/<BR>
$ mkdir cobol<BR>
$ cd cobol<BR>
$ tar xf ../linuxcob.tar<BR>
$ mkdir samples<BR>
$ cd samples<BR>
$ tar xf ../ucbsampl.tar<BR>
$ cd ..<BR>
$ /bin/su <BR>
# install cobolscript.exe -o root -g root -m755 /usr/local/bin/cobolscript.exe <BR>

<font face="Courier">install</font>
is a useful command. In the incarnation above, it does a
<font face="Courier">copy</font>
<font face="Courier">chown</font>
, and
<font face="Courier">chmod</font>
all in one! While it's used mainly in installation scripts, it's so darn handy I use it all the time for other things too. In this case, I installed
<font face="Courier">cobolscript.exe</font>
from the current directory into
<font face="Courier">/usr/local/bin</font>
<font face="Courier">chown</font>
ed it to root,
<font face="Courier">chgrp</font>
ed it to root, and
<font face="Courier">chmod</font>
ed it to 755 (rwxr-xr-x).

Deskware recommends pointing your

<font face="Courier">PATH</font>
at the directory where you've installed the CobolScript interpreter, but as you can see, I installed it in
<font face="Courier">/usr/local/bin/</font>
. That's because Deskware also recommends that you install the interpreter into your
<font face="Courier">cgi-bin</font>
directory -- which is a big security no-no. You'll see what steps I took to solve the problem later in this article.

Even though I installed CobolScript and its interpreter in

<font face="Courier">/usr/local/bin/</font>
, I still had to run my CobolScript scripts by explicitly invoking the interpreter: for example,
<font face="Courier">cobolscript.exe foo.cbl</font>
. To save me this agony, the Linux facility
<font face="Courier">binfmt_misc</font>
allowed me to use the following command to associate all files having the extension
<font face="Courier">.cbl</font>
<font face="Courier">cobolscript.exe</font>

<font face="Courier">
# echo ':CobolScript:E::cbl::/usr/local/bin/cobolscript.exe:' > /proc/sys/fs/binfmt_misc/register<BR>

Note that I was still in superuser mode when I did that.

To discover

<font face="Courier">binfmt_misc</font>
for yourself and use it <!-- for your own nefarious purposes --> to register filetypes to be automatically run by a specific interpreter, first see if it isn't already installed on your system (look in the
<font face="Courier">/proc/sys/fs/binfmt_misc</font>
directory); to read more about it, consult the kernel documentation in
<font face="Courier">/usr/src/linux/Documentation/binfmt_misc.txt</font>

CobolScript features

CobolScript provides the basic tools necessary to get the job done. Programming-language basics such as arithmetic operations, output formatting, data structures, and file input/output (topics covered in Kernighan and Ritchie's "C Programming Language"; see Resources) are all there and easy to use. The manual is complete and precise, but it's an Adobe PDF document, which makes it difficult to

<font face="Courier">grep</font>

1 2 Page 1
Page 1 of 2
ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon