> -----Original Message-----
> From: Jakub Jelinek <ja...@redhat.com>
> Sent: Saturday, March 15, 2025 20:57
> To: Robert Dubner <rdub...@symas.com>; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH]cobol: create new
> gcc/testsuite/cobol.dg/group1/check_88.cob test
[...]
> 
> I don't know what the line length limits in COBOL are (and if it applies
> to comments too) 

Speaking casually:

COBOL, like FORTRAN back when Fortran was all uppercase, came from a time
when 80-character punched cards were so much better than punched paper
tape that the world standardized on them as if nothing better would ever
come along.

Fixed-form, known as "reference format", is still more-or-less required by
IBM.  Forced in gcobol with the option "-ffixed-form".  Can be controlled
inside a source code file with the compiler directive ">> SOURCE FORMAT IS
FREE"

Columns 1-6  ignored
Column    7  * for comment, - for continuation, and a few other special
things
Column    8  Area A -- labels started here
Column   12  Area B -- statements go here
Column   73 and beyond are ignored

Free-form, is much more forgiving.  Forced with "-ffree-form", or from
inside the program with ">> SOURCE FORMAT IS FIXED"

There is no line limit in free form; the entire program could fit on a
single line.

GCOBOL uses a heuristic when the format is unspecified.  It looks at the
first line of source code.  If the first six characters are digits or
blanks, it switches to "extended reference format", where the first six
characters are ignored, column seven is the indicator column, *> comments
can start anywhere, and there is no line length limit.

COBOL is a cruel world.

Reply via email to