The advent of Object Oriented COBOL compilers made it possible to wrap cobol code as objects.
Specifically, a component based approach to COBOL (just as with any language) has many advantages.
String2Num is a simple but very useful component. It is demoed here so you can see the way in
which components allow functionality to be encapsulated and re-used over and over, sometimes for
decades. Code which is constantly maintained eventually has to be scrapped or rewritten; components
generally don't.
|
What is this COMPONENT stuff all about? We've been writing modular COBOL for
decades. Isn't this just a "re-invention" with a heap of wrapping
overhead that nobody needs or wants?
|
No, there are advantages of the component based approach which are quite spectacular.
MicroSoft gave us
OLE (Object Linking and embedding) which allowed objects to be linked and
embedded into documents and Web pages, as well as desktop applications. Of course, COBOL couldn't
play on this particular field because it wasn't Object Oriented. By the time COBOL BECAME object
oriented, the OLE technology had evolved into the
COMPONENT OBJECT MODEL (COM). COM objects
can run anywhere... (not just in MS environments; they can be easily brokered by CORBA to the
Linux, Apache, MySQL, Perl/PHP/Python (LAMP) environment also).
If you download the String2Num component being demonstrated here, you can run it
on a web server, a client web page, or embedded into your own applications on
the Windows desktop. You can use it ANYWHERE you need to be sure that something
is numeric, even for inter-program communication. (You don't HAVE to invoke any methods
that activate a user interface, and the component will not activate them by itself.)
|
String2Num is a piece of mainframe COBOL code, written for an IBM System 360
back in 1974. It was intended to ensure that data being input into 3270 (green
screen) fields was numeric, when it was supposed to be. |
Although the 3270 had attribute bytes that were supposed to ensure that only numeric data
could be entered, in practice this was not foolproof, and using attributes like this meant
that the system was tied to 3270 devices.
A more general means of checking numeric input was needed. Not just from screen data fields, but for
inter-program communication and, indeed, anywhere that numeric data integrity needed to be
established. The code was migrated to different platforms and ran on ICL 1900s, CDC Cyber70,
and Honeywell mainframes.
With the advent and spread of PCs the code was ported to the IBM PC platform around 1985, using Micro Focus
COBOL, where it performed with the same reliability it had shown on the mainframes. When OO COBOL
became available, it was again ported to become a Class that could be instantiated anywhere it was
needed. Finally, in a Fujitsu COBOL incarnation, it became a COM component that can be run on the
desktop or embedded into Web Pages.
Today, 35 years after it was first written, THE SAME CORE COBOL CODE has been wrapped to
run with .NET InterOP services and is available as a C# Assembly. The demo you see here is the
ActiveX component running on our server as a C# code-behind page. The code has had an extra
section added to handle floating point numbers in Scientific notation, some numeric field
formats have been changed to suit the PC platform, but the rest of the
component remains as the original.
Enjoy trying String2Num! If you like it and want to embed it in your own applications,
you can obtain and use it for free, without limitation.(See"Download", below)
Here is the demo...
Back to TOP OF PAGE...