Welcome to HCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to HCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Compile and run COBOL code online instantly with HCODX. Our free cloud-based COBOL compiler supports real-time execution, standard input, syntax highlighting, and code download. No installation or configuration required. Start coding in COBOL now.
Run COBOL instantly without installing any IDEs or configuring environments. Our cloud-based COBOL handles libraries, runtimes, and dependencies automatically so you can focus on writing code.
Whether you are studying algorithms in COBOL, practicing data structures in COBOL, or exploring functional programming, our tool provides real-time stdout/stderr feedback with interactive standard input support.
HCODX is a free online compiler and code runner: write code in your browser, execute it on a cloud sandbox, and interact with your program through a live terminal. Students use it for coursework and interview practice; developers use it to test snippets in 85+ languages without setting up a local environment.
By most estimates, hundreds of billions of lines of COBOL are still in production — processing bank transactions, insurance claims, payroll runs, and government benefits every single day. Designed in 1959 with Grace Hopper's ideas at its core, COBOL was built to read like business English and to handle exact decimal arithmetic, which is precisely why finance never left it. The language is not frozen: the ISO COBOL 2023 standard is current, IBM ships new Enterprise COBOL releases, and the open-source GnuCOBOL compiler makes learning it free. With mainframe veterans retiring, modernization teams actively recruit developers who can read COBOL. This page compiles COBOL and runs it in a live terminal where ACCEPT statements wait for your real typed input.
IDENTIFICATION DIVISION.
PROGRAM-ID. INTEREST-DEMO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-NAME PIC X(30).
01 NUM-YEARS PIC 9(2).
01 ACCT-BALANCE PIC 9(7)V99 VALUE 1000.00.
01 YEAR-COUNT PIC 9(2) VALUE 0.
01 SHOW-BALANCE PIC $Z,ZZZ,ZZ9.99.
PROCEDURE DIVISION.
DISPLAY "What is your name? " WITH NO ADVANCING.
ACCEPT USER-NAME.
DISPLAY "Hello, " FUNCTION TRIM(USER-NAME) "!".
DISPLAY "Grow $1000 at 5% for how many years? "
WITH NO ADVANCING.
ACCEPT NUM-YEARS.
PERFORM NUM-YEARS TIMES
COMPUTE ACCT-BALANCE = ACCT-BALANCE * 1.05
ADD 1 TO YEAR-COUNT
END-PERFORM.
MOVE ACCT-BALANCE TO SHOW-BALANCE.
DISPLAY "After " YEAR-COUNT " years: " SHOW-BALANCE.
STOP RUN.
COBOL is a career play: banks, insurers, and government agencies in the US, UK, Canada, and Australia run core systems on it and pay well for people who can maintain and modernize them — IBM's mainframe training initiatives exist precisely because demand outstrips supply. Use this page to learn the fundamentals recruiters screen for: DIVISION structure, PIC clauses and decimal arithmetic, PERFORM loops, and formatted output. It's also practical for developers on modernization projects who need to decode a copybook or verify how a COMPUTE rounds before touching production JCL. HCODX is a free online COBOL editor, runner and interpreter — an IDE-grade compiler and playground to write and run code online, execute code with live output and live preview, no downloads or web server required.
Yes — ACCEPT pauses the program until you type a value in the terminal, and DISPLAY ... WITH NO ADVANCING keeps the prompt on the same line, so the classic prompt-and-respond flow works exactly like a terminal-attached batch program. Multiple ACCEPT statements in sequence each wait for their own input.
Programs compile with GnuCOBOL, the open-source compiler that translates COBOL to C. It follows the standards closely and supports most IBM-style syntax, so the core language you practice — data division layouts, PERFORM, COMPUTE, intrinsic functions — transfers directly to Enterprise COBOL, though mainframe-specific facilities like CICS and DB2 precompilers won't exist here.
In traditional fixed-format COBOL, yes: area A starts at column 8 and statements begin in area B at column 12, which is why the example indents with seven leading spaces. GnuCOBOL also supports free-format source, but learning fixed format is wise since virtually all legacy mainframe code uses it.
Your current code will be replaced with the default sample. This cannot be undone — download your code first if you want to keep it.
You have unsaved changes. Do you want to save your code before continuing?