RE: COBOL compiler
On Tue, 2003-08-26 at 13:29, David Turetsky wrote:
> > On Tue, 2003-08-26 at 10:05, Kirk Strauser wrote:
> > > At 2003-08-26T14:25:32Z, Ron Johnson <ron.l.johnson@cox.net> writes:
> > >
> > > > For a "Hello, World" program, or an OS, or a graphics toolkit,
> even
> > > > Admiral Hooper would not say that COBOL is the proper tool. OTOH,
> for
> > > > large commercial apps, COBOL is far and away the best tool for the
> > > > job. . . .
> > >
> >
> > From: Ron Johnson [mailto:ron.l.johnson@cox.net]
> > Sent: Tuesday, August 26, 2003 12:47 PM
> > To: Debian-User
> > Subject: Re: COBOL compiler
>
> >
> > The greatness of COBOL is the fact that it is a honed tool. Just
> > as C is great for low-level work, COBOL is *designed* to move,
> > process, sort, summarize, etc. fixed-length records around.
> >
> > For example, COBOL has intrinsic constructs for easily handling
> > ISAM files in a variety of manners. Likewise, there is a very
> > powerful intrinsic SORT verb.
> >
>
> Yes, but how does that compare with similarly powerful features in Perl?
I *knew* someone would ask about the Programmable Extraction and
Reporting Language...
Please don't think that I am implying that Perl or C are bad languages.
I certainly wouldn't write a logfile analyzer in COBOL.
For my knowledge, how would Perl sort the contents of a file,
allowing the programmer to use a complex algorithm as an
input filter, and then take the output stream, processing it
1 record at a time, without needing to write to and then read
from temporary files with all of the extra SLOC that that entails?
One thing that I don't think that any of the "modern" languages
do, without extra libraries and function calls, is BCD arithmatic.
Here's a simplistic example of how COBOL is specialized:
Say we have 2 record definitions:
01 A-SMALL-REC.
05 FIRST-NAME PIC X(15).
05 LAST-NAME PIC X(15).
01 A-LARGE-REC.
05 HONORIFIC PIC X(5).
05 FIRST-NAME PIC X(15).
05 MIDDLE-I PIC X.
05 LAST-NAME PIC X(15).
05 MODIFIER PIC X(5).
MOVE 'JOHN' TO A-SMALL-REC.FIRST-NAME.
MOVE 'DOE' TO A-SMALL-REC.LAST-NAME.
MOVE SPACES TO A-LARGE-REC.
MOVE CORRESPONDING A-SMALL-REC TO A-LARGE-REC.
Here, A-SMALL-REC.FIRST-NAME and A-SMALL-REC.LAST-NAME will be
moved to the corresponding fields in A-LARGE-REC.
In such a trivial example, so what? If, however, there are many
fields in A-SMALL-REC, then MOVE CORRESPONDING is a big coding
time-saver, and ensures that if the records definitions ever
change, the code will still work.
--
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
The difference between drunken sailors and Congressmen is that
drunken sailors spend their own money.
Reply to: