Follow this steps:
-
Install MSYS2.
-
Install thoroughly the gcc compiler via MSYS2 terminal. This may take some minutes. Execute:
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
-
Install gnucobol. To list the available packages use:
pacman -Ss cobol.
- I chose the second one because of my architecture. You may want to choose a different one.
pacman -S --needed base-devel mingw-w64-x86_64-gnucobol
-
(May not be necessary) Configure gnucobol.
To this point the compiler should be ready to perform its duty.
Notice that these steps ought to be similar to the ones used for Windows. Take into account your architecture, base-devel
was mine. Moreover, you may consider executing cobenv.sh
instead of .cmd
whenever you ought to configure gnucobol.
The first 6th characters are reserved, as well as, the 7th. Both, have specific purposes. Section A (that's how being called) immidiately follows, Section B comprises around 60 characters, until the 73d character. There is still one section to mention at the end, that is for punched cards and, fortunately, is deprecated. Write:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY "HELLO WORLD!".
STOP RUN.
There is out there a lot of documentation in reference to this same topic. Therefore, I am not going to pretend to extend it, but to point out the basics. Execute the following command:
cobc -v
If gnucobol was properly installed, it should be returning this:
To compile a program execute:
cobc -x hello-world.cob -o hello-world
You'll recieve a brand new exec file.
You can compile and then link the different files (.o
extensions) by calling:
We can determine the standard with std=
for instance:
cobc -std=cobol85 -x hello-world.cob -o hello-world
I guess, a reliable (but not a good one) source of information, must be found in IBM: cobol language reference.
Another one: developer docs cobol.