gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Best online and text tutorials?


From: John Culleton
Subject: Re: [open-cobol-list] Best online and text tutorials?
Date: Mon, 11 Aug 2008 08:25:44 -0400
User-agent: KMail/1.9.9

On Saturday 09 August 2008 11:34:30 am Brian Tiffin wrote:
> On August 9, 2008 12:57:52 am address@hidden 
wrote:
> > I would state that a simple Hello World Program in COBOL
> > has become MUCH simpler than his example. We no long
> > are required to have all those sections or even the preceding
> > line numbers.
>
> Yeah, on the opencobol.org forum (and in the soon to be unveiled
> FAQ), hello world is as short as
>
> program-id.hello.procedure division.display "Hello World!".
>
> Cheers,
> Brian
>

There was a language in my youth called APL whose fan base reveled in 
creating one line programs. I hope COBOL  and its fan base has not 
been reduced to that level. An important and unique feature of COBOL 
is that it was designed to be read as well as written.  It is 
intended to be a self-documenting language. While recent versions 
have strayed far from that original concept the thought of reducing a 
sample program to one line is a violation of one of the key features 
that makes COBOL different from other languages. Just because you can 
do it doesn't mean you should do it. 

Another key feature of COBOL is that it is a file handling language.  
Hence my template includes the major headers required for file 
handling. 

The use of line numbers  is a matter of personal taste. As an old time 
COBOL dude I prefer them.  Ditto upper case versus lower case.  But 
many compilers will choke on a program that lacks all four divisions.  
Hence an example program that omits them is IMO a misleading one. 

I would at a minimum rearrange the one-liner thus:

identification division.
program-id. hello. 
procedure division.
     display "Hello World!".
     stop run.

IMO of course. 

---------------------------------------------------------------------------
John Culleton


reply via email to

[Prev in Thread] Current Thread [Next in Thread]