Hello, I’m Duke
COBOL – a 65-year-old language, yet it is used in large financial and banking systems.
Learning it is relatively difficult because it is little known and is almost as old as a human lifetime. Besides, in the past, we could only program on mainframe systems—something that individual programmers could hardly access.
But, today I will guide you on how to program it on personal PCs running Windows 11 operating system, yeah.
To run COBOL code on Windows 11 without the need for a mainframe, you need:
- Download and Install the Visual Studio Code here
- Install the following extensions: bitlang.cobol-themes, bitlang.cobol, ms-vscode-remote.remote-wsl
- Install WSL follow the instructions here
- Install Debian on Windows Store here
Once installed, you need to install and setup a few things
1. Update Debian
sudo apt update
sudo apt upgrade -y
2. Install GnuCOBOL Compiler
sudo apt install gnucobol4 -y
Okay, we are done with the installation and configuration, now let’s get down to writing code and compiling.
Firstly, create a hello.cbl
file and then write the following code
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. PROCEDURE DIVISION. DISPLAY 'Hello, I am Duke!'. STOP RUN.
On Visual Studio Code the code will look like this
Then, open Visual Studio Code terminal and run the following command
cobc -x hello.cbl
The -x
flag tells cobc to create an executable.
After running this command, a file named hello
will be created.
Now run the command below to execute
./hello
and you will see the text Hello, I am Duke!
appear on the terminal window
Discover more from Coursity
Subscribe to get the latest posts sent to your email.