Interactive companion · Medium article

I Wrote This Article In COBOL.
Then I Read It In Java.

See every code snippet from the article side-by-side with its Java 21 equivalent. Then try the live transpiler on your own code.

Try the live transpiler See the snippets ↓
220B+
COBOL transactions / day
5,077
Programs in our corpus
100%
COBOL handle rate
< 1s
Average translation time

Three programs from the article. Left panel: the original. Right panel: the Java 21 output from Language Foundry's deterministic transpiler.

Snippet 1 — The article itself, in COBOL
The simplest possible COBOL program: an identification header, a procedure division, three DISPLAY statements, and STOP RUN. Even non-programmers can read it. That's actually one of COBOL's design goals — it was meant to be auditable by managers.
→
COBOL MEDIUM-ARTICLE.cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. MEDIUM-ARTICLE.

PROCEDURE DIVISION.

DISPLAY "MOST PEOPLE THINK COBOL IS DEAD."

DISPLAY "UNFORTUNATELY FOR THEM,"
        " COBOL DID NOT GET THE MEMO."

DISPLAY "THIS ARTICLE IS AVAILABLE"
        " IN MULTIPLE PROGRAMMING LANGUAGES."

STOP RUN.
Java 21 MediumArticle.java
public class MediumArticle {

  public static void main(String[] args) {

    System.out.println(
      "Most people think COBOL is dead."
    );

    System.out.println(
      "Unfortunately for them,"
      + " COBOL did not get the memo."
    );

    System.out.println(
      "This article is available"
      + " in multiple programming languages."
    );
  }
}
Snippet 2 — Business logic: loan approval
The canonical legacy modernization example: a conditional rule buried in COBOL. The business rule — approve accounts over $1M with an A rating — is identical in both languages. Only the syntax changes.
→
COBOL LOAN-CHECK.cbl
IF ACCOUNT-BALANCE > 1000000
   AND CUSTOMER-RATING = 'A'
THEN
   MOVE 'APPROVED' TO STATUS
END-IF
Java 21 LoanCheck.java
if (accountBalance > 1000000
    && customerRating.equals("A")) {

    status = "APPROVED";
}
Snippet 3 — RPG: the language nobody talks about
RPG runs on IBM i servers and processes a significant share of global payroll. Most developers have never seen it. The intent is immediately readable — even if the syntax is unfamiliar. Language Foundry transpiles RPG to Java 21 with a 99.7% handle rate across 1,739 real-world files.
→
RPG IV PAYROLL-MSG.rpgle
dcl-s Message varchar(100);

Message =
  'Nobody remembers RPG.';

dsply Message;

Message =
  'Until payroll stops working.';
dsply Message;
Java 21 PayrollMsg.java
String message =
    "Nobody remembers RPG.";

System.out.println(message);

message =
    "Until payroll stops working.";

System.out.println(message);

Try it on your own code

Paste any COBOL or RPG program into the live transpiler and get Java 21 back instantly. Work email required — 10 free runs, no credit card.

Open live transpiler Talk to us about a migration →