This blog article shows you how to compile COBOL program in Windows. It is pretty hard to find COBOL compiler. Those compiler links in the Internet are either broken or extreme commence such as Visual COBOL. Till now I only found a free COBOL compiler GnuCOBOL that is quite good to run the legacy code. You can either download it from SourceForge, https://gnucobMinGW ol.sourceforge.io/, you need to compile using MinGW or you can download the one already built here.
Copy the build version into C:\gnucobol or other directory that you prefer. Add C:\gnucobol\bin to Path environment variable.
The best COBOL book for learn I found is https://www.bookdepository.com/Sams-Teach-Yourself-COBOL-21-Days-Second-Edition-Mo-Budlong/9780672311376/?WT.mc_id=DP-MVP-36769. Although it is from 1997. The code you can paste to GnuCOBOL and compile with the lesser issue than other COBOL books.
To test the compiler, you can copy and paste the code from the book as template like below.
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLO.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000700 PROGRAM-BEGIN.
000800 DISPLAY “I said, Hello world”.
001000 PROGRAM-DONE.
001100 STOP RUN.
Save as hello.cob. Start a command prompt and type cobol -t- hello.cob.
Then you will get the exe. Run the exe. You will see the result below.
References: https://bigdanzblog.wordpress.com/2020/05/05/installing-gnucobol-on-windows/?WT.mc_id=DP-MVP-36769