COBOL is something I use at work. Typically, you see IF blocks like this

IF condition

But the END-IF part if actually optional. You can just use a period and it does the same thing.

IF condition

Many headaches if not caught when reading.

  • 1
    I find it worse that some implementations have e.g. DISPLAY as a "block" (e.g. DISPLAY whatever END-DISPLAY; alternatively terminated with a .) and some don't even understand END-DISPLAY.

    Btw. "." is the original way to end statements, before END- was introduced.
  • 1
    @sbiewald If it was consistent I wouldn't care. But we have several multi thousand line program that sometimes omit the end if and sometimes use it.
  • 2
    I worked for 1.5 years with Cobol. And I didn’t even have the right to use “advanced” features like calls and returns. Everything needed to be done with GOTOs. Because other devs (age average of 60, I was 23) couldn’t understand the concept.
    I decided to purge these 1.5 tears from my resume. Put personal projects instead. One of which was : A cobol code generator from a simple WYSIWG tools I made to design the flow.
  • 3
    Such mixed feelings about color. I truly miss 88 levels. Don't miss the absence of good tooling.
  • 2
    Color, wtf phone 😸 Cobol. Damnit
  • 0
    Yeah and finding that dot that ends the whole if-statement is annoying.

    Even worse is the use of next sentence. Or looping a set of data using go-to’s.

    I even dislike the use of paragraph numbering or putting sections in cronological order like this.

    a section.
    perform ab section
    perform ac section
    exit section.
    ab section.
    perform aba section
    exit section.
    aba section.
    *> do something
    exit section.
    ac section.
    perform aca section
    exit section.
    aca section.
    *> do something
    exit section.

    What happens if you want to perform another section before the ab? You have to rename all sections because the new section has to have the prefix ab.
  • 1

    We use numbered blocks


    When methods meet to go in-between they take the half. Works okay.
Add Comment