Re: Where are spaces required in COBOL source code?





Chuck Stevens wrote:
> Let's try that again. Things got messed up in the editing, and perhaps I
> was too abrupt.
>
> <epc8@xxxxxxxx> wrote in message
> news:1117154259.996313.163080@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> > The compiler ... requires a
> > variable name to be separated by at least one space from the
> > parentheses enclosing a subscript (or an expression denoting reference
> > modification). ...
>
[snip]

> > Please note that the first language I learned was FORTRAN using
> > fixed-form (punched card) format. There spaces are only meaningful
> > inside string literals.
>
> Getting as much as possible accomplished on a single line of source code
> used to be considered the hallmark of Expert Coding. This has passed out of
> favor -- even in languages where it is common like FORTRAN and ALGOL --
> because it's rarely very readable and often difficult to maintain. It's
> not just FORTRAN.
>

I was just explaining my background, not my preferences :-). When I
phrased the second part of the question I was thinking of the language
from the point of view of someone writing a parser for the language.
Somehow the questions I posed seemed more interesting at the time I
wrote them :-(.

Re: spaces required around colons in reference modification expression.
I am unable to reproduce this problem. Sorry.

[snip]

> The general stylistic rule for COBOL is that COBOL is based on English, in
> which letters are combined into words that are separated by spaces and
> punctuation marks. The punctuation rules are similar to those for English
> as well, including the frequent requirement that certain punctuation marks
> be followed by at least one space. Some specifics may have changed over
> time, but a separator space where it is allowed is
> rarely a Bad Idea in COBOL.
>
> What is considered readable code in COBOL generally bears a very close
> relationship to the rules of English punctuation. In that language,
> typically, at least one space follows a comma or period or semicolon, a
> parenthetical expression is separated from its preceding text by a space,
> and the contents of a parenthetical expression most often are adjacent to
> their enclosing parentheses. Such is the convention with COBOL.
>
> -Chuck Stevens

Thanks for a very considered, concise and literate description!

.



Relevant Pages

  • Re: Java compatibility issues (WAS: MF having issues?)
    ... language it can do most of what C, C++, and Java can do. ... 2002 COBOL standard addresses that, but having a standard is a far ... Some flavours do have libraries. ... On the IBM mainframe we have Language Environment but it does ...
    (comp.lang.cobol)
  • Re: COBOLs Influence on C
    ... Cobol is the only language that has this problem. ... sure that the libraries containing ANYTHING that might be called are on ... And that is one reason why installations have Local Standards... ...
    (comp.lang.cobol)
  • Re: Java is becoming the new Cobol
    ... """If you're a Java developer, now's the time to invest in new ... It is even truer for COBOL developers. ... The question then is: Is Java just another fad language in the range: ... Sometimes it appears they'll use whatever the Fad Language Of The Month Club sent last ...
    (comp.lang.cobol)
  • Re: Wang COBOL alive and well as Wang VS makes a comeback
    ... I fought to the last to keep COBOL at least peripherally in the ... will be the next language du jour... ... This contributes to the stability of programming efforts ... level of COBOL to another can be as big a deal as migrating across platforms ...
    (comp.lang.cobol)
  • Re: GoTo in Java
    ... were a year or two down the track and everybody was very happy with OCaml. ... > language switch would pay off in faster development (due in part to ... COBOL as a scripting language for .NET. ... Compare this with COBOL programmers discussing Java... ...
    (comp.lang.cobol)