Search code examples
syntaxruntime-errorcobolgnucobol

GnuCOBOL entry point not found


I've installed GnuCOBOL 2.2 on my Ubuntu 17.04 system. I've written a basic hello world program to test the compiler.

1       IDENTIFICATION DIVISION.
2       PROGRAM-ID. HELLO-WORLD.
3      *---------------------------
4       DATA DIVISION.
5      *---------------------------
6       PROCEDURE DIVISION.
7           DISPLAY 'Hello, world!'.
8           STOP RUN.

This program is entitled HelloWorld.cbl. When I compile the program with the command

cobc HelloWorld.cbl

HelloWorld.so is produced. When I attempt to run the compiled program using

cobcrun HelloWorld

I receive the following error:

libcob: entry point 'HelloWorld' not found

Can anyone explain to me what an entry point is in GnuCOBOL, and perhaps suggest a way to fix the problem and successfully execute this COBOL program?


Solution

  • According to the official manual of GNUCOBOL, you should compile your code with:

    cobc -x HelloWorld.cbl
    

    then run it with

    ./HelloWorld
    

    You can also read GNUCOBOL wiki page which contains some exmaples for further information.

    P.S. As Simon Sobisch said, If you change your file name to HELLO-WORLD.cbl to match the program ID, the same commands that you have used will be ok:

    cobc HELLO-WORLD.cbl
    cobcrun HELLO-WORLD