When to use dots in COBOL?

cobol, cobol85, gnucobol

Solution

The period ends the "sentence." It can have an effect on your logic. Consider...

IF A = B
    PERFORM 100-DO
    SET I-AM-DONE TO TRUE.

...and...

IF A = B
    PERFORM 100-DO.
    SET I-AM-DONE TO TRUE

The period ends the IF in both examples. In the first, the I-AM-DONE 88-level is set conditionally, in the second it is set unconditionally.

Many people prefer to use explicit scope terminators and use only a single period, often on a physical line by itself to make it stand out, to end a paragraph.

Problem

I'm completely new to COBOL, and I'm wondering: There seems to be no difference between ``` DISPLAY "foo" ``` and ``` DISPLAY "foo". ``` What does the dot at the end of a line actually do? When should I use/avoid it?

Original source