[net.lang] How standard is COBOL ?

wapd@houxj.UUCP (Bill Dietrich) (11/08/84)

	I have almost no experience with COBOL, but I thought
it was very well standardized, compared to most languages.
I thought there were 7 levels or packages, an ANSI standard,
and so on.

	But I was reading the Nov 84 Unix/World, and the
article "A Software Vendor's Search" by Neal Nelson
says "... I had written applications in Data General COBOL,
IBM Series/1 COBOL and IBM 370 COBOL.  The manufacturer
and operating system had made these three versions of COBOL
so different that moving from one machine to another was
almost as difficult as starting over in a new language."

	Is this typical of different COBOL versions ?

					Bill Dietrich
					houxj!wapd

johnl@godot.UUCP (11/11/84)

My impression is that Cobol is the best standardized of widely used languages.
Most Cobols have lots of implementation-specific extensions to deal
with screen packages, telecommunication monitors, and such, and I suspect
that the guy who was complaining wrote his programs without regard to what
was standard and what was not.

I've heard hearsay of Cobol programs many thousands of lines long being
ported changing only the environment division (a dozen lines, perhaps) which
is defined to be implementation specific.

John Levine, ima!johnl

PS:  How many other languages let you write:

	IF KICK-BACK GREATER THAN 10 AND LESS THAN 100 THEN ...

without having to mention kick-back twice?  They don't design them like they
used to.  Probably just as well.

henry@utzoo.UUCP (Henry Spencer) (11/13/84)

> My impression is that Cobol is the best standardized of widely used
> languages.

Certainly it is the *most* standardized, in a specific sense of the word:
as Bill Plauger pointed out in Washington, since the COBOL standard has
something like 12 different pieces that can be present or not in any given
implementation, there are 4096 different standard COBOLs.  That's easily
the most standards of any language I know.  Poor old FORTRAN only has
two (well, three if you count FORTRAN 66).
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

rcd@opus.UUCP (Dick Dunn) (11/13/84)

> 	I have almost no experience with COBOL, but I thought
> it was very well standardized, compared to most languages.
> ...
> 	But I was reading the Nov 84 Unix/World, and the
> article "A Software Vendor's Search" by Neal Nelson
> says "... I had written applications in Data General COBOL,
> IBM Series/1 COBOL and IBM 370 COBOL.  The manufacturer
> and operating system had made these three versions of COBOL
> so different that moving from one machine to another was
> almost as difficult as starting over in a new language."
> 
> 	Is this typical of different COBOL versions ?

COBOL is certainly standardized, but there are two problems:

	It has a real peculiarity--implementors are allowed to add reserved
	words!  Given the structure of COBOL, most extensions will require
	new words.  Given the application area for COBOL, there's a
	reasonable chance that new reserved words will collide with the
	identifiers used in a program written for a different
	implementation.

	It's an old language.  The older a language gets, the more
	extensions are added, to solve new problems or solve old problems
	better.  The extensions differ, so you have to be careful about
	what "features" you use if you're trying to write programs which
	are both portable and reasonably efficient.

The second problem can be battled with care and a standard-checking
compiler.  The only hope for the first one (something I attacked once) is to
collect a huge list of all of the reserved words on all the implementations
you can find out about, and avoid ALL of the words.  (The list will be in
the hundreds of words.)
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...Never attribute to malice what can be adequately explained by stupidity.

dre@ptsfa.UUCP (Doug East) (11/14/84)

> PS:  How many other languages let you write:
> 
> 	IF KICK-BACK GREATER THAN 10 AND LESS THAN 100 THEN ...

If I'm not mistake, which I could very well be, this particular nicety
is not ANSI standard but is implemented on many compilers.  It was on
the CDC Cyber 7xx compilers along with some other very nonstandard stuff
like reference modification (ala FORTRAN-like):

	MOVE THIS-IS-A-STRING ( 5 : 8 ) TO THIS-IS-A-SUBSTRING.

And a very nice END-IF statement for the IF-THEN-ELSE structure which
helps one keep track on the #?*% period.  It also closed off a nested
IF so that it would behave properly without the funky NEXT SENTENCE stuff:

	IF WHO-KNOWS-WHAT > ALOT THEN
		IF ALOT NOT > A-LITTLE THEN
			DISPLAY "ALOT IS TOO LITTLE"
		END-IF
	ELSE
		DISPLAY "WHO-KNOWS-WHAT KNOWS LITTLE"
	END-IF.

Rather than:

	IF WHO-KNOWS-WHAT > ALOT THEN
		IF ALOT NOT > A-LITTLE THEN
			DISPLAY "ALOT IS TOO LITTLE"
		ELSE
			NEXT SENTENCE
	ELSE
		DISPLAY "WHO-KNOWS-WHAT KNOWS LITTLE"
	END-IF.

However, all in all, I'm glad I don't program in it any more.

	Doug East (Pacific*Bell -- San Francisco)
	{ihnp4,ucbvax,cbosgd,decwrl,amd70,fortune,zehntel}!dual!ptsfa!dre

rdf@latour.DEC (11/14/84)

COBOL is indeed the most standardized (?) language I have seen, but in the case
of companies like IBM, DG,DEC and others, many extensions have been made which
do inhibit transporting software. 

Make no mistake though, DG's "screen section" for on-line COBOL programming, 
DEC's VAX COBOL extensions , and IBM's little "ON 1" all help sell more 
hardware for each company.  Its up to the customer to not use extensions and
stick to the standard when developing applications that they even think would 
have to be ported to a different O/S someday.  

As was said before, all you sometimes have to change is the ENVIRONMENT 
DIVISION, but this would be a well thought out applicaton.  Standards are great,
but if extensions are allowed, then compiler writers should not be the only
ones looking at them.

Rick

eugene@ames.UUCP (Eugene Miya) (11/19/84)

[]

Interesting following this discussion.

I, too, have heard that COBOL is the most standardized language, and I
have spent some time sitting on sitting on another ANSI committee, but
my experience with the COBOL language tells me that COBOL standardization
is something of a joke.

Several years ago, a large research lab was analysing the conversion of
software to newer systems.  This facility had a large Univac and a slightly
smaller IBM population.  The Univac people were in the seats of power, but
the important administrative work was done on a 3032.  As a research
project using Maurice Halstead's Software Science measures, we ran
millions of lines of Univac FORTRAN and IBM COBOL thru counting
programs to 'analyze' the nature of shifting software from one manufacturer
to another.  I found that IBM COBOL was "closer" to COBOL standard
with about 300 reserved words than Univac COBOL with about 500 reserved
words.

In the end we had to dump the analysis of the IBM->Univac conversion
because the cost of adding the 200 additional keywords was beyond
research budget (we had all that FORTRAN to analyse).  These programs
did not just count line of code mind you, and we knew that languages
were more than the sum of the reserved words, but I thought I
would add some quantitative evidence to the COBOL discussion.

[In the end, the Univac forces `won' but the COBOL still sits on an IBM.]

--eugene miya
  NASA Ames Res. Ctr.
  {hplabs,ihnp4,dual,hao,vortex}!ames!aurora!eugene
  emiya@ames-vmsb.ARPA

mwm@ea.UUCP (11/20/84)

/***** ea:net.lang / ima!johnl /  8:22 pm  Nov 17, 1984 */
PS:  How many other languages let you write:

	IF KICK-BACK GREATER THAN 10 AND LESS THAN 100 THEN ...

without having to mention kick-back twice?  They don't design them like they
used to.  Probably just as well.
/* ---------- */

At least three. The (much more readable, to my mathematically warped mind)
line:

	10 < KICK-BACK < 100

will work correctly in both BCPL and Icon. I'm not sure how BCPL does
it, but Icon has the notion of "success" and "failure" of an expression.
For instance, the statement

	if x < 10 then a :=: b

will exchange a and b iff the expression "x < 10" succeeds. This happens
if x is less than 10, and the expression has the value 10. Hence,
10 < x < 100 is either 100, or fails.

In LISP, the expression (< 10 KICK-BACK 100) should work.

	<mike

cjl@iuvax.UUCP (11/27/84)

>it, but Icon has the notion of "success" and "failure" of an expression.
>For instance, the statement
	>if x < 10 then a :=: b
>will exchange a and b iff the expression "x < 10" succeeds. This happens
>if x is less than 10, and the expression has the value 10. Hence,
>10 < x < 100 is either 100, or fails.

  The relational operators in ICON return numbers, not boolean values.
Actually there are no explicit boolean values in ICON but faillure, and success.
Therefore 3 < 8 > 1 or (3 < 8) > 1 are evaluated successfully, but
   3 < (8 > 1) return failure !!!!
The reason is 8 > 1 returns 1 not 8.

I cannot agree ICON's approach is easy to understand because this kind of 
language semantics is not natural and used in nowhere but some programming
languages where there is no explicit boolean values.

C.J.Lo
ARPA : cjl@Indiana@CSNet-Relay
UUCP : ...!iuvax!cjl