Back to Blog
February 17, 2026 min readmicroservices extracting legacy workflow

RPG to Microservices: Extracting Legacy ERP Workflow Secrets

R
Replay Team
Developer Advocates

RPG to Microservices: Extracting Legacy ERP Workflow Secrets

Your mission-critical business logic is trapped inside a green screen. Thousands of lines of RPG IV and RPGLE code, written decades ago by developers who have since retired, govern your inventory, order processing, and financial ledgers. Every time you attempt to migrate these systems, you hit a wall: the documentation is non-existent, and the cost of manual extraction is prohibitive. This is the "Legacy Trap."

The transition to microservices extracting legacy workflow data is no longer a luxury—it is a survival requirement. However, the traditional approach of manual code audits and "big bang" rewrites is a recipe for disaster. According to Replay’s analysis, 70% of legacy rewrites fail or significantly exceed their timelines because the original business requirements have been buried under layers of procedural patches.

TL;DR: Transitioning from RPG-based ERPs to modern microservices requires a shift from manual code analysis to Visual Reverse Engineering. By using Replay to record user workflows, enterprises can bypass the $3.6 trillion technical debt problem, reducing screen modernization time from 40 hours to just 4 hours. This guide explores how to extract legacy workflow secrets and transform them into documented React components and microservice architectures.


The Technical Debt of RPG: Why Microservices Extracting Legacy Workflow is Critical#

The global technical debt has reached a staggering $3.6 trillion. For organizations running on IBM i (AS/400) systems, this debt is compounded by the "Semantic Gap." RPG is a positional, procedural language designed for record-level processing. Microservices, conversely, are event-driven and decoupled.

When teams attempt microservices extracting legacy workflow logic through manual analysis, they often spend months just trying to understand the "hidden" rules—the validation checks and edge cases that exist only in the code. Industry experts recommend a "Visual-First" approach because the UI is the only place where the business logic and the user's intent actually meet.

Visual Reverse Engineering is the process of capturing live application sessions and programmatically converting those interactions into structured documentation, UI components, and API schemas.

The Cost of Manual vs. Automated Extraction#

MetricManual RPG ExtractionReplay Visual Reverse Engineering
Time per Screen40+ Hours4 Hours
Documentation Accuracy45% (Subjective)99% (Observed)
Average Project Duration18–24 Months3–6 Months
Failure Rate70%< 10%
Resource Requirement5 Senior RPG Devs1 Architect + Replay

Step 1: Mapping the "Green Screen" to Modern Components#

The first hurdle in microservices extracting legacy workflow is the UI mismatch. RPG screens (DSPF) are fixed-width, character-based interfaces. Modern microservices require responsive, state-driven React frontends.

Instead of reading the RPG source code to guess what a field does, Replay allows you to record a subject matter expert (SME) performing a standard workflow, such as "Generate Purchase Order." Replay's AI Automation Suite then analyzes the video, identifies the input patterns, and generates a functional React component that mirrors the legacy behavior but uses modern best practices.

Example: Legacy RPG Order Entry to React#

In the old system, an order entry might be a series of

text
EXFMT
(Execute Format) commands. Here is how that workflow is transformed into a modern, type-safe React component using the output from Replay.

typescript
// Generated by Replay Blueprints from Legacy Workflow: "Order Entry" import React, { useState, useEffect } from 'react'; import { OrderService } from '@/services/order-service'; import { Button, Input, Card, Alert } from '@/components/ui-library'; interface OrderEntryProps { initialData?: any; onComplete: (orderId: string) => void; } export const LegacyOrderEntry: React.FC<OrderEntryProps> = ({ onComplete }) => { const [formData, setFormData] = useState({ customerId: '', sku: '', quantity: 0, warehouse: 'WH-01' // Extracted default from legacy logic }); const [error, setError] = useState<string | null>(null); const handleSubmit = async () => { try { // Replay identified this specific validation sequence from the legacy recording if (formData.quantity <= 0) throw new Error("Quantity must be greater than zero."); const response = await OrderService.createOrder(formData); onComplete(response.id); } catch (err: any) { setError(err.message); } }; return ( <Card title="Modernized Order Entry"> {error && <Alert type="error">{error}</Alert>} <Input label="Customer ID" value={formData.customerId} onChange={(v) => setFormData({...formData, customerId: v})} /> <Input label="SKU" value={formData.sku} onChange={(v) => setFormData({...formData, sku: v})} /> <Input type="number" label="Quantity" value={formData.quantity} onChange={(v) => setFormData({...formData, quantity: parseInt(v)})} /> <Button onClick={handleSubmit}>Submit Order</Button> </Card> ); };

Step 2: Extracting Business Logic for Microservices#

The "secrets" of a legacy ERP are often hidden in the subfiles and indicators of the RPG code. When microservices extracting legacy workflow data, you need to identify the "State Machine" of the application.

Industry experts recommend using Replay's Flows to map out these state transitions. By recording multiple variations of a workflow, Replay builds a visual architecture of how data moves through the system. This allows architects to define microservice boundaries based on actual usage rather than arbitrary code modules.

Video-to-code is the process of using computer vision and machine learning to interpret UI changes and translate them into functional code blocks and API definitions.

Bridging the Data Gap#

In many RPG systems, the database (DB2/400) is tightly coupled with the UI. To move to microservices, you must decouple these layers. Replay facilitates this by generating "Contract Blueprints." These blueprints define exactly what data the new microservice must provide to support the modernized UI.

Modernizing Legacy UI with React


Step 3: Implementing the Microservice Architecture#

Once the workflows are extracted, the next phase of microservices extracting legacy workflow involves building the backend services. Since Replay provides the "Flows" (the sequence of operations), your developers can focus on writing the business logic in Node.js, Go, or Java, rather than spent time deciphering 40-year-old RPG logic.

According to Replay's analysis, enterprises that use visual recordings to define their API contracts reduce "rework" by 55% during the development phase.

Modernizing the Workflow Logic (TypeScript Example)#

Here is a look at how a legacy "Credit Check" workflow, extracted via Replay, is implemented as a modern microservice handler.

typescript
/** * Microservice: CreditService * Logic extracted from RPG Module: CRDCHK01R * Workflow: "Validate Customer Credit" */ import { Request, Response } from 'express'; import { db } from './database'; export const validateCustomerCredit = async (req: Request, res: Response) => { const { customerId, orderTotal } = req.body; try { const customer = await db.customers.findUnique({ where: { id: customerId } }); if (!customer) { return res.status(404).json({ message: "Customer not found" }); } // This logic was extracted from a Replay recording of an SME // handling a 'Credit Limit Exceeded' pop-up in the legacy system. const availableCredit = customer.creditLimit - customer.currentBalance; const isApproved = availableCredit >= orderTotal; return res.status(200).json({ approved: isApproved, remainingCredit: availableCredit - (isApproved ? orderTotal : 0), requiresManagerOverride: orderTotal > 10000 && !isApproved }); } catch (error) { return res.status(500).json({ error: "Internal Server Error" }); } };

Overcoming the Documentation Vacuum#

One of the greatest risks in any ERP migration is the fact that 67% of legacy systems lack documentation. When you are microservices extracting legacy workflow, you are essentially performing archaeology.

Replay’s Library feature acts as a living Design System and documentation hub. As you record workflows, Replay automatically categorizes components and flows, creating a "Single Source of Truth" that didn't exist in the legacy environment. This is vital for regulated industries like Financial Services and Healthcare, where SOC2 and HIPAA compliance require clear audit trails of how data is processed.

Automated Documentation for Legacy Systems

Practical Steps for Microservices Extracting Legacy Workflow#

  1. Identify the Core Workflows: Don't try to modernize everything at once. Use Replay to record the top 20% of workflows that drive 80% of your business value (e.g., Order Entry, Inventory Adjustment).
  2. Record and Analyze: Use the Replay platform to capture these workflows. Let the AI Automation Suite identify the patterns and generate the initial React components and Flow diagrams.
  3. Define API Contracts: Use the generated components to define the JSON schemas for your new microservices.
  4. Iterative Deployment: Deploy the modernized UI (built with Replay-generated components) using a "Strangler Fig" pattern, where the new React frontend communicates with new microservices, which in turn call the legacy RPG backends via APIs or message queues.
  5. Decommission: Once the microservice has successfully replicated the legacy logic, the RPG module can be retired.

Why Visual Reverse Engineering is the Future#

The "Manual Rewrite" is a relic of the past. The sheer volume of technical debt ($3.6 trillion) means we cannot hire enough developers to manually modernize every legacy system. Microservices extracting legacy workflow must be automated.

Replay offers an on-premise solution for highly regulated environments, ensuring that your sensitive ERP data never leaves your network while still benefiting from the power of AI-driven modernization. By reducing the time per screen from 40 hours to 4 hours, Replay allows enterprise architects to deliver results in weeks, not years.

Frequently Asked Questions#

How does Replay handle complex RPG subfiles?#

Replay’s Visual Reverse Engineering engine recognizes common patterns in legacy UIs, such as subfiles (grids) and command keys (F-keys). It translates these patterns into modern React components like Data Tables and Action Bars, preserving the functional intent while upgrading the user experience.

Is Replay compatible with on-premise AS/400 systems?#

Yes. Replay is built for regulated environments and offers an on-premise deployment option. This allows organizations in government, healthcare, and finance to modernize their RPG workflows without exposing sensitive data to the public cloud.

Can we use Replay to generate a full Design System?#

Absolutely. One of the core features of Replay is the Library. As you record workflows, Replay identifies reusable UI patterns and organizes them into a comprehensive Design System. This ensures consistency across your new microservices and React applications.

What is the average ROI of using Replay for ERP modernization?#

Organizations typically see a 70% average time savings. By moving from an 18-month manual rewrite timeline to a 3-6 month automated extraction process, companies save millions in developer hours and avoid the opportunity cost of delayed digital transformation.

Does Replay require access to the RPG source code?#

No. Replay operates on the visual layer. It analyzes the rendered UI and user interactions to extract the workflow secrets. This makes it ideal for systems where the source code is lost, poorly documented, or too complex to parse manually.

Ready to modernize without rewriting? Book a pilot with Replay

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free