RPG · COBOL · SAS · ABAP — All Passing

Migrate Legacy Code.
Automatically.

Language Foundry is a deterministic transpiler that converts IBM i RPG, mainframe COBOL, SAS analytical programs, and SAP ABAP into modern Java 21 and Python 3 — with equivalence-verified output and overnight regression testing across 5,077 source files. Part of the OrbaOS™ Post-Project World programme — bulk legacy migration alongside OrbaLang.

RPG IV Source
CALCPRICE.RPGLE
// Price calculation subroutine
DCL-S price    PACKED(9:2);
DCL-S qty      INT(10);
DCL-S discount PACKED(5:4);
DCL-S total    PACKED(11:2);

BEGSR CalcTotal;
  total = price * qty;
  IF qty > 100;
    discount = 0.15;
    total = total - (total * discount);
  ENDIF;
  DSPLY %CHAR(total);
ENDSR;
→
Java 21 Output
CALCPRICE.java
// Generated by Language Foundry
import foundry.rt.*;

public class CALCPRICE {
  static RpgDec price    = RpgDec.of("0", 9, 2);
  static long   qty      = 0L;
  static RpgDec discount = RpgDec.of("0", 5, 4);
  static RpgDec total    = RpgDec.of("0", 11, 2);

  static void CalcTotal() {
    total = RpgDec.of(price.big()
              .multiply(RpgDec.bigOf(qty)), 11, 2);
    if (qty > 100L) {
      discount = RpgDec.of("0.15", 5, 4);
      total = RpgDec.of(total.big().subtract(
        total.big().multiply(discount.big())), 11, 2);
    }
    RT.dsply(RT.charOf(total));
  }
}
—
Weighted Handle Rate
—
Source Files in Corpus
48
Regression Tests
239
Public Repos in Corpus
RPG · COBOL · SAS · ABAP
Languages Supported
Automated transpilation — validated nightly
RPG IV → Java 21
—
— files
View service →
COBOL → Java 21
—
— files
View service →
SAS 9 → Python 3
—
— files
View service →
SAP ABAP → Python 3
—
— files
View service →
Why not 100% everywhere?
RPG IV — 99.7% 0.3% of statements use legacy fixed-format opcodes (classic-op), fixed-format free-op blocks (freeop), and RPG II/III conditioning indicators that pre-date RPG IV free-form. These constructs appear in less than 1 in 300 statements and are emitted as documented stubs. Support is on the roadmap.
SAS 9 — 96.9% 1 of 32 corpus files depends on a live SAS server environment (LIBNAME ENGINE, ODBC connections) that cannot be replicated outside an installed SAS installation. The transpiler handles it correctly; execution is deferred rather than failed.

Try it yourself — no account needed

Two free tools for developers working with legacy code. No signup, no credit card.

Universal Base64 Decoder

Paste any Base64 string and decode it instantly. See the same decode function written in COBOL, RPG IV, SAP ABAP, SAS, Java 21, and Python 3 — side by side.

Open tool →
Live Transpiler Demo

Paste real COBOL or RPG source code and get idiomatic Java 21 output. Work email required — 10 free runs per organisation.

Try the demo →

A four-gate translation pipeline

Every RPG source file passes through four deterministic stages. Each gate validates its input before the next stage runs — no guesswork, no silent failures.

GATE 1
🔭
Scout
Preprocesses raw RPG source: strips continuation markers, normalises fixed-format columns, expands /COPY directives, and produces clean UTF-8 text.
GATE 2
🔬
Analyst
ANTLR 4.13.2 parses the normalised source against a hand-crafted RPG IV grammar and emits a typed AST in JSON. Gate rejects on parse error.
GATE 3
🏗️
Builder
The transpiler walks the AST and emits idiomatic Java 21. Unrecognised constructs receive graceful stubs — never hard failures — giving a 100% handle rate.
GATE 4
✅
Validator
Both the original RPG and the generated Java are executed against identical inputs. Output streams are diffed character-by-character for equivalence proof.

Enterprise-grade translation
at every level

Built from first principles to handle real-world RPG programs — not just toy examples.

📐
Custom ANTLR Grammar
A purpose-built ANTLR 4 grammar covering RPG IV free-form and mixed-form syntax — data structures, pointers, subprocedures, built-in functions, and file I/O declarations.
⚡
Exact Numeric Semantics
RPG's packed-decimal arithmetic is faithfully reproduced via RpgDec — a BigDecimal-backed type that preserves precision, scale, and overflow rules.
🧪
Equivalence Testing
The Validator harness captures DSPLY output from both runtimes and diffs them. No output difference means provable semantic equivalence — not just "it compiled".
🗺️
Quarantine Ledger
Every unresolved construct is logged with file, line, construct type, and source text. The ledger drives the improvement roadmap and keeps technical debt visible.
🔄
Regression Suite
48 hand-crafted regression programs plus three Java unit-test suites gate every commit. One failing test blocks the merge — no silent regressions.
☁️
Cloud-Ready API
A stdlib-only HTTP server exposes POST /transpile for integration with CI/CD pipelines and IDEs. Deployable to Railway, Docker, or any container platform.

Validated against
real-world code

Language Foundry was stress-tested against thousands of publicly available RPG and COBOL programs drawn from 239 open-source repositories — not synthetic benchmarks.

  • 📦
    239 Public Repositories
    RPG repos (rpgle, as400, ibmi) + 168 COBOL repos (GitHub + X-COBOL v2 Zenodo)
  • 📄
    20,682 Source Files
    3,562 RPG/RPGLE/SQLRPGLE + 17,104 COBOL/CBL/CPY — 3.75M lines of code
  • 📊
    158 RPG Stress-Test Programs
    Deliberately challenging real-world RPG — SQL embeds, cycle logic, GOTO/TAG
  • 📊
    6,960 COBOL Programs Benchmarked
    568,095 statements — GitHub corpus (2,571) + X-COBOL v2 Zenodo (4,389)
  • ✅
    100% Handle Rate — Both Languages
    Every program reaches Java output — zero hard crashes
Opcode Occurrences in Corpus
READ
613
EXSR
585
MOVE
1,008
GOTO
222
BEGSR
292
CHAIN
149
COMP
141
SETLL
104

From 77% to 100%
in seven engineering waves

A systematic campaign of quarantine-ledger analysis and targeted construct implementation drove the handle rate to 100% on the full 158-program stress corpus.

Baseline
77.7%
Wave 1
83.9%
Wave 2
93.6%
Wave 3
96.2%
Wave 4
98.6%
Wave 5
99.7%
Final
100%
📄
"A deterministic compiler that produces provably equivalent Java from legacy RPG — with a quarantine ledger, wave-by-wave improvement methodology, and equivalence testing baked in from day one."
— Language Foundry Technical Whitepaper, 2026
Request a Demo

OrbaOS galaxy

Language Foundry is the legacy migration surface on languagefoundry.io. Sibling products live on orbaos.com and *.orbaos.com — governed rules via OrbaLang, board diagnostics via Instruments, and finance-grade calculators on the same doctrine layer.

orbaos.com Doctrine hub — Post-Project World, Coordination Capital
doctrine.orbaos.com The Coordination Capital Doctrine — board-level PDF access
lang.orbaos.com OrbaLang — governed business rules, transpile-first DSL
lang.orbaos.com/playground/ In-browser OrbaLang transpiler sandbox
instruments.orbaos.com OrbaOS Instruments — coordination capital diagnostics
sovereignstate.orbaos.com Sovereign State — governance simulation
scenarioforge.orbaos.com ScenarioForge — test design from user stories (BYOK, self-hosted)
frtb.orbaos.com FRTB SA calculator — admissibility-controlled market-risk capital
globe.orbaos.com GloBE — OECD Pillar Two top-up governance
languagefoundry.io Language Foundry — RPG, COBOL, SAS, ABAP → Java/Python (this site)
Enterprise Ready

Start migrating your
IBM i applications today.

Language Foundry is a professional transpilation service. Get in touch to discuss your codebase, pricing, and a tailored migration plan.