If you don’t know COBOL (and I clearly don’t know it well enough), you probably won’t spot that there’s a syntax error here:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BLAH.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       LINKAGE SECTION.

       PROCEDURE DIVISION.

           DISPLAY 'BLAH.' UPON CONSOLE.

           STOP-RUN.

The C equivalent to this program is:

#include <stdio.h>
int main(){
  printf("BLAH.\n");
}

but it is meant to have an exit(0), so we want:

#include <stdio.h>
int main(){
  printf("BLAH.\n");
  return 0;
}

Translating that back into COBOL, we need the STOP-RUN statement to say STOP RUN (no dash).  With the -, this gets interpreted as a paragraph label (i.e. STOP-RUN delimits a new function) with no statements in it. What I did was something akin to:

#include <stdio.h>
void STOPRUN(){
}
int main(){
  printf("BLAH.\n");
  STOPRUN();
}

The final program doesn’t have the required ‘return 0’ or ‘exit(0)’ and blows up with a “No stop run nor go back” error condition.  Logically, what I really wanted was:

 

       IDENTIFICATION DIVISION.
       PROGRAM-ID. BLAH.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       LINKAGE SECTION.

       PROCEDURE DIVISION.

           DISPLAY 'BLAH.' UPON CONSOLE

           STOP RUN

           .

 

This time I’ve left off the period that I had after CONSOLE (which was superfluous and should really only be used at the end of the paragraph (end of “function”)), and also fixes the STOP-RUN -> STOP RUN typo.

This is not the first time I’ve gotten mixed up on when to use DASHES or not.  For example, even above, I’d not expect a programmer to know or remember that you need to know to use dashes for WORKING-STORAGE and PROGRAM-ID but not for PROCEDURE DIVISION, nor some of the other space delimited fields.

My eyes are burning, and I left my COBOL programmer safety gear at home.