Where are spaces required in COBOL source code?



While playing around with the COBOL12 compiler (discussed elsewhere
recently in this newsgroup), I ran into a few peculiarities. This is a
DOS compiler that looks like a subset of 74 standard COBOL but has some
extensions and some omissions. Its display is unusual since it uses a
graphics mode to display text. Anyway I noticed two strange things. The
compiler does not accept blank lines in source code and it requires a
variable name to be separated by at least one space from the
parentheses enclosing a subscript (or an expression denoting reference
modification). An old CP/M era compiler also had this requirement for
subscripts (of course there was no reference modification).

1. Was this ever part of a COBOL standard?

2. I sometimes find it puzzling that spaces seem to be required around
certain things in COBOL when I don't expect them to be. For example
after commas (in CALL), around the colon in reference modification (at
least in the compilers I've tested) and around operators in a COMPUTE
expression.

Please note that the first language I learned was FORTRAN using
fixed-form (punched card) format. There spaces are only meaningful
inside string literals.

Is there a general rule about this for COBOL and has it changed with
different versions of the standard?

(Sorry if this is a FAQ.)

.



Relevant Pages

  • Re: compile+link Fujitsu Linux
    ... The Cobol standard has supported pointers for six years, ... It is common for most of a large business application to be written in Cobol, ... You don't know Python then. ... chosen the compiler options and link parameters that work best for me. ...
    (comp.lang.cobol)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... These days I don't do compiler maintenance, but I HAVE done in the past, so ... You had a chance to point out how adherence to the standard can improve ... >> compile it WITH MINOR MODIFICATIONS for a specific platform. ... > platform-specific extension to COBOL ...
    (comp.lang.cobol)
  • Getting the "program name"
    ... In Standard of COBOL, ... POTENTIALLY distinct in some compilers and operating systems: ... In other environments (compiler / OS combinations) it might be ...
    (comp.lang.cobol)
  • Re: In answer to RW - again (was: Sorts (revised)
    ... If the Cobol compiler just compiles defective code ... >> a greater probability the Cobol and SQL parents will work together to fix it. ... or perhaps the SQL standard defines Cobol. ...
    (comp.lang.cobol)
  • Re: Where are spaces required in COBOL source code?
    ... > parentheses enclosing a subscript (or an expression denoting reference ... Was this ever part of a COBOL standard? ... least one space between the arguments, the compiler should accept it. ...
    (comp.lang.cobol)