Back to Blog
February 10, 20269 min readlegacy system

RPG IV to React: Rescuing Automotive Supply Chain Logic from Black-Box Legacy Systems

R
Replay Team
Developer Advocates

Your supply chain is currently held together by code written before your lead developers were born. In the automotive sector, where Just-In-Time (JIT) manufacturing is the law of the land, the RPG IV logic powering your inventory management isn't just "old"—it’s a high-stakes liability. When the original authors of your core business logic have retired and 67% of your legacy system lacks any form of updated documentation, you aren't managing a platform; you’re managing a ticking clock.

The global technical debt bill has reached $3.6 trillion, and the automotive industry carries a disproportionate share. For decades, the "Green Screen" was the gold standard for stability. Today, it is a bottleneck that prevents API integration, slows down warehouse throughput, and makes hiring talent nearly impossible. The traditional solution—a "Big Bang" rewrite—is a documented failure, with 70% of enterprise rewrites exceeding their timelines or failing entirely.

The future of rescuing these systems isn't manual archaeology. It’s Visual Reverse Engineering.

TL;DR: Modernizing automotive supply chain logic from RPG IV to React no longer requires 18-month "Big Bang" rewrites; by using Replay to record user workflows, enterprises can extract documented components and logic in weeks, achieving 70% time savings.

The High Cost of Manual Archaeology in the Supply Chain#

When an automotive giant decides to move from an IBM i (AS/400) environment to a modern stack, the first instinct is to hire a consultancy to "analyze the code." This is where the money vanishes. Manually documenting a single complex screen in a legacy system takes an average of 40 hours. In a typical supply chain ERP with 500+ screens, you are looking at years of discovery before a single line of React is written.

The "black box" problem is real. RPG IV logic often contains decades of "temporary" patches that became permanent business rules. If you miss the logic that calculates lead times for a specific Tier-2 supplier in Germany, the entire production line stops.

Comparing Modernization Strategies#

ApproachTimelineRiskDocumentationCost
Big Bang Rewrite18-24 monthsHigh (70% fail)Manual/Incomplete$$$$
Strangler Fig12-18 monthsMediumPartial$$$
Manual Refactoring24+ monthsHighPoor$$$$
Replay (Visual RE)2-8 weeksLowAutomated/Full$

💰 ROI Insight: Manual extraction costs ~$4,000 per screen (based on $100/hr dev rates). Replay reduces this to ~$400 per screen by automating the discovery and component generation phase.

Rescuing Logic Without Reading 500,000 Lines of RPG#

The core challenge of rescuing a legacy system is that the source code is often decoupled from the actual user intent. A developer looking at fixed-format RPG code might see a series of

text
CHAIN
and
text
UPDATE
operations but miss the nuance of how a floor manager actually handles a "damaged goods" exception.

Replay flips the script. Instead of reading the code to understand the workflow, Replay records the workflow to understand the code. By capturing the real-time interaction between the user and the legacy system, Replay generates a visual "source of truth."

The 4-Step Extraction Workflow#

Step 1: Workflow Recording#

A subject matter expert (SME) performs a standard task—such as a "Part Reconciliation" or "BOM Update"—within the existing green-screen or legacy web interface. Replay records the session, capturing every state change, data entry point, and API call (or terminal screen transition).

Step 2: Visual Mapping#

Replay’s AI Automation Suite analyzes the recording. It identifies recurring UI patterns and maps them to modern React components. It doesn't just take a screenshot; it understands that a specific terminal grid is, in fact, a data table with sorting and filtering logic.

Step 3: Component Generation#

The platform generates clean, type-safe React code. This isn't "spaghetti code" generated by a basic transpiler. It’s structured, modular code that fits into your modern Design System (Library).

Step 4: Logic Preservation#

This is the most critical phase for automotive supply chain applications. Replay extracts the underlying business logic—the "if-then" statements buried in the RPG—and documents them as API contracts and E2E tests.

typescript
// Example: Extracted React Component from a Legacy Inventory Screen // Generated by Replay Visual Reverse Engineering import React, { useState, useEffect } from 'react'; import { InventoryTable, AlertBox } from '@acme-auto/design-system'; import { useInventoryLogic } from './hooks/useInventoryLogic'; interface PartProps { warehouseId: string; initialData: any[]; } export const PartReconciliation: React.FC<PartProps> = ({ warehouseId, initialData }) => { const { data, reconcile, loading, error } = useInventoryLogic(warehouseId); const [parts, setParts] = useState(initialData); // Business logic preserved from RPG IV: // If part is 'Safety Critical', flag for secondary audit const handleReconcile = async (partId: string) => { const isCritical = parts.find(p => p.id === partId)?.type === 'CRITICAL'; await reconcile(partId, isCritical); }; return ( <div className="p-6"> <h2 className="text-xl font-bold">Warehouse Reconciliation: {warehouseId}</h2> {error && <AlertBox message="Sync failed with IBM i backend" type="error" />} <InventoryTable data={parts} onAction={handleReconcile} isLoading={loading} /> </div> ); };

⚠️ Warning: Never attempt to modernize a supply chain system without first generating an E2E test suite. Without a baseline of how the legacy system behaves today, you have no way to verify the new system's accuracy.

From Black Box to Documented Codebase#

One of the greatest risks in automotive manufacturing is the "Knowledge Silo." Only one or two senior architects might understand how the EDI (Electronic Data Interchange) logic interacts with the warehouse picking system. When they leave, the legacy system becomes a literal black box.

Replay’s "Blueprints" feature provides a visual map of the entire architecture. It shows how data flows from the user interface down to the database layers. This is "Documentation without Archaeology." Instead of spending months writing Confluence pages that will be obsolete in weeks, Replay provides a living, breathing map of your application's DNA.

Technical Debt Audit#

Before you write a single line of React, Replay performs a Technical Debt Audit. It identifies:

  • Dead Paths: Workflows in the legacy system that are no longer used by any employees.
  • Redundant Logic: Duplicate validation rules across different screens.
  • Complexity Hotspots: Areas where the RPG logic is so convoluted that it requires special attention during the migration.

📝 Note: In regulated industries like automotive and healthcare, Replay’s ability to run On-Premise is vital. You can modernize your supply chain without your sensitive data ever leaving your secure network.

Bridging the Gap: The Strangler Fig 2.0#

The "Strangler Fig" pattern involves gradually replacing specific functionalities of a legacy system until the old system is completely "strangled" and can be decommissioned. While effective, it usually takes 12-18 months.

Replay accelerates this by providing the "Bridge." Because Replay generates API contracts and E2E tests automatically, you can stand up a modern React frontend that communicates with your legacy RPG backend via a secure middleware layer in a matter of days.

typescript
// Example: Generated API Contract for Legacy Integration // This allows the React frontend to talk to the RPG backend during the transition export interface LegacyInventoryAPI { /** * Maps to RPG Program: INVRNC01 * Description: Reconciles physical count with system records */ reconcileCount: (params: { partNumber: string; warehouseCode: string; quantity: number; userInitials: string; }) => Promise<{ status: 'SUCCESS' | 'ERROR'; variance: number; requiresAudit: boolean; }>; }

Why Automotive Leaders are Choosing Visual Reverse Engineering#

In the world of automotive supply chain management, downtime is measured in millions of dollars per hour. You cannot afford a modernization project that "might" work in two years. You need a predictable, data-driven approach.

  1. Speed to Market: Moving from 18 months to a few weeks allows you to respond to market shifts (like the transition to EV components) much faster.
  2. Reduced Risk: By using the "Video as Source of Truth," you ensure that the new React application performs exactly like the legacy system it replaces.
  3. Talent Acquisition: It is significantly easier to hire world-class React developers than it is to find RPG IV specialists in 2024.
  4. Compliance: With SOC2 and HIPAA-ready configurations, Replay meets the stringent security requirements of the global automotive industry.

Overcoming the "Documentation Gap"#

67% of legacy systems lack documentation. This is the single biggest hurdle to modernization. When you ask a developer to modernize a system they don't understand, they will inevitably make assumptions. In a supply chain, assumptions lead to shipping delays and inventory stockouts.

Replay eliminates the need for assumptions. By capturing the actual execution of the software, it documents the as-is state perfectly. This allows your team to focus on the to-be state—improving the UI, optimizing the workflow, and integrating with modern AI and analytics tools.

Frequently Asked Questions#

How long does legacy extraction take with Replay?#

While a manual audit of a complex legacy system can take 6-12 months, Replay typically completes the extraction and component generation phase in 2-8 weeks. The timeline depends on the number of unique workflows, but the 70% time savings remains consistent across enterprise projects.

Can Replay handle complex business logic hidden in RPG IV?#

Yes. Replay doesn't just look at the UI; it records the data transformations and state changes. By analyzing these patterns, Replay helps generate API contracts and business logic summaries that represent the underlying RPG code's behavior, making it easy to port to Node.js, Go, or Java.

Does Replay require access to our source code?#

No. Replay works via Visual Reverse Engineering. It observes the application's behavior through the user interface and network layers. This is particularly useful for rescuing systems where the source code is lost, obfuscated, or poorly commented.

Is the generated React code maintainable?#

Absolutely. Replay generates standard, type-safe React (TypeScript) code that follows modern best practices. It uses your existing design system components, ensuring the new screens look and feel like the rest of your modern stack.

How does Replay handle security in regulated industries?#

Replay is built for enterprise-grade security. We offer On-Premise deployment options for automotive, financial services, and government sectors. We are SOC2 compliant and HIPAA-ready, ensuring that your supply chain data remains protected throughout the modernization process.


Ready to modernize without rewriting? Book a pilot with Replay - see your legacy screen extracted live during the call.

Ready to try Replay?

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

Launch Replay Free