This content originally appeared on DEV Community and was authored by Raziq Din
For my very first post on this platform, I’ll be guiding you through a simple “Hello World” program in COBOL, while also giving a quick breakdown of the key syntax you’ll need to make it work.
But before we dive into the code, let’s take a step back and look at COBOL’s origins, and why it still powers over 70% of legacy systems in critical sectors like finance, banking, and beyond.
What is COBOL?
Common Business-Oriented Language a.k.a COBOL is a high-level , English-like compiled programming language that is developed specifically for business data processing needs.
What led to the founding of COBOL?
In the late 1950s , each operating systems that has existed at the time has it's own programming languages. However , this somehow leads to hurdles between companies as they had to work with systems of numeral brands and made cross-company data processing difficult. Grace Hopper(1906-1992), one of the pioneers in the Computer Science field, saw this issue and therefore created the early version of the language called FLOW-MATIC to simplify business programming tasks, which later inspired Conference on Data Systems Languages (CODASYL) to create COBOL programming language. Ever since then, COBOL was integrated and used by thousands of companies all around the world, producing over 800 billion of legacy code that is consistently maintained by the people in the country all around the world until now.
Is COBOL still in use in the field today?
Well, to put this in to perspective, you are using part of COBOL's several code snippets every time you wave your debit or credit card when you want to make a payment at any stores or shops. So yes, it is being used and relevant until this day.
COBOT "Hello World" Code Snippet
The code snippet below is the full code snippet and required syntax to print a basic "Hello World". Let me guide you slowly as you cannot skip any order based on the code here, as it holds strong functionality and purpose for the program to run.
IDENTIFICATION DIVISION.
PROGRAM-ID. helloworld.
PROCEDURE DIVISION.
DISPLAY "hello world".
STOP RUN.
Pretty simple, right? Yes it is. That’s because COBOL was designed to make programming easier by using an English-like syntax. This approach ensures that programs are easier to read, write, and maintain, even for those who aren’t professional programmers!
Now, let's go through all the fundamental syntax and it's purpose to make the program runs smoothly.
1. IDENTIFICATION DIVISION
IDENTIFICATION DIVISION
*> should be coded first as the first division in cobol program
*> provides metadata about the program , such as its name , author , components required to make the cobol ecosystem recognize the syntax
*> mandatory division in COBOL program
IDENTIFICATION DIVISION. is the first mandatory component in the COBOL program that provides documentary information , including the property of the program itself such as the name and the type of program. The syntax will recognize the date compiled , author or any relevant info about the program in the ecosystem. Take this syntax as the initializer of the whole program in your COBOL file , or simply put , a "cover page" of the program.
It does not disturb the program logic or your main COBOL code. So don't worry lol. Check out the extended example below as you can add this info to your code after IDENTIFICATION DIVISION.
Extended Example
IDENTIFICATION DIVISION.
*> below are the info about this COBOL program
PROGRAM-ID. PayrollSystem.
AUTHOR. Raziq Din.
INSTALLATION. Hospital Kuala Lumpur.
DATE-WRITTEN. August 2025.
REMARKS. Handles employee payroll and deductions.
2. PROGRAM-ID.
PROGRAM-ID. helloworld.
*> used to specify the program name
*> mandatory and should be in the first entry after the IDENTIFICATION DIVISION.
*> helloworld. is user defined alphanumeric word that identifies the program uniquely
*> take it like a unique id for each program to make it unique
PROGRAM-ID is a required syntax after declaring IDENTIFICATION DIVISION. in your program. This is the syntax that will identify your program name uniquely. You are free to name it however you want BUT , there are certain rules:-
Length:
up to 30 characters only for a program name.
Characters:
the name must consists from alphabets (A-Z,a-z), digits (0-9), hyphens (-) or underscores (_).
Alphabetical Requirements:
At least one character in the name must be in alphabetic and the first character must be in alphabetical
Underscore Restrictions:
Cannot be at the start or end of the program name
Hyphens Restrictions:
Cannot be at the start and end of the program name
Reserved COBOL words:
Avoid using it , like really , it might cause conflict (e.g MOVE , IF)
Uniqueness:
Your program name must be different in each COBOL file, when you work with multiple COBOL files , you will need to rename it uniquely
3. PROCEDURE DIVISION.
PROCEDURE DIVISION.
*> defines the all operations that will be written in the cobol file
PROCEDURE DIVISION. holds that whole logic of COBOL program. This syntax will operate on the data that was defined in the DATA DIVISION. (will talk about it after this) and uses a structured format based on sections , paragraphs, or statements. Since COBOL language is procedural programming based language , the program will usually run from the top line until the last line (from top to bottom).
4. DISPLAY "Hello World".
DISPLAY "hello world".
*> output the string "hello world" to the terminal
DISPLAY means output. I mean , it literally mean output. To your Command Line Interface (CLI). Yes. You write DISPLAY and include your "yourmessage" after it.
5. STOP RUN.
STOP RUN.
*> terminate the program
STOP RUN. will end your program runtime.
Expected Output
Here is the output expected from your terminal:
So there you have it, a "Hello World" display program. Now that you’ve read through it, it’s essential to understand that COBOL syntax relies on specific keywords, each carrying a very particular purpose. Missing or misplacing even one can cause the program to fail.
That said, this strict structure is also what makes COBOL so reliable for business-critical applications. Once you grasp the fundamentals, like IDENTIFICATION DIVISION, PROGRAM-ID, PROCEDURE DIVISION, and statements such as DISPLAY and STOP RUN , you’ll have the foundation to explore more advanced COBOL features, from handling data files to building complete business systems.
Hope you enjoy the reading! Apologies for any little misinformation! I'm happy to learn more!
This content originally appeared on DEV Community and was authored by Raziq Din

Raziq Din | Sciencx (2025-08-27T07:36:49+00:00) How to print “Hello World” in COBOL (Common Business-Oriented Language). Retrieved from https://www.scien.cx/2025/08/27/how-to-print-hello-world-in-cobol-common-business-oriented-language-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.