Back to Blog
February 10, 20269 min readrpg modernization moving

RPG IV Modernization: Moving High-Volume Merchant Settlement Logic to React with 0% Error Rates

R
Replay Team
Developer Advocates

70% of legacy rewrites fail or exceed their timeline, often resulting in millions of dollars of sunk cost and zero modernization to show for it. In the high-stakes world of merchant settlement, where high-volume transactions must be processed with 0% error rates, the "Big Bang" rewrite isn't just a risk—it's a suicide mission. For decades, RPG IV (Report Program Generator) has been the bedrock of financial services, powering the back-end logic of global payment processors. But as the talent pool of AS/400 experts shrinks and the demand for real-time React-based interfaces grows, the pressure to migrate is reaching a breaking point.

The problem isn't the destination; it's the map. 67% of legacy systems lack any meaningful documentation. When you are tasked with rpg modernization moving mission-critical settlement logic, you aren't just coding; you are performing digital archaeology on a black box.

TL;DR: Modernizing RPG IV merchant settlement systems requires moving from manual code archaeology to visual reverse engineering with Replay, reducing migration timelines from years to weeks while maintaining 0% error rates.

The High Cost of Traditional RPG Modernization Moving Strategies#

The global technical debt burden has ballooned to $3.6 trillion. A significant portion of this is trapped in IBM i (AS/400) environments. When a Tier-1 financial institution decides to move its merchant settlement logic from RPG to a modern stack like React and Node.js, they typically choose one of two paths: the "Big Bang" rewrite or the "Strangler Fig" pattern.

Both are fraught with peril. The Big Bang approach ignores the "Lindy Effect"—the idea that the longer a piece of software has survived, the longer it is likely to survive. RPG IV is incredibly stable. Attempting to replicate 30 years of edge-case handling in a single 18-month project is why the failure rate is so high. The Strangler Fig is safer but agonizingly slow, often taking 24 months just to migrate a handful of core modules.

The Comparison: Manual vs. Automated Extraction#

MetricManual RewriteStrangler FigReplay (Visual Reverse Engineering)
Timeline18–24 Months12–18 Months2–8 Weeks
Risk ProfileExtreme (High Failure)MediumLow (Validated)
DocumentationManual/OutdatedPartialAutomated/Real-time
Cost$$$$$$$$
Error RateHigh (Human Error)Moderate0% (Logic Extraction)
Human Effort40 hours per screen30 hours per screen4 hours per screen

💰 ROI Insight: By utilizing Replay, enterprises see an average of 70% time savings. What used to take 40 hours of manual analysis per green screen now takes 4 hours of visual extraction.

Why Merchant Settlement Logic is a "Black Box"#

Merchant settlement is the process of calculating net totals, deducting interchange fees, managing chargeback reserves, and initiating ACH transfers. In RPG IV, this logic is often buried in thousands of lines of fixed-format or free-form code, intertwined with DB2 database triggers.

When rpg modernization moving projects begin, the first hurdle is always the documentation gap. The original architects are often retired, and the "source of truth" is the running application itself, not the code comments. This is where "Visual Reverse Engineering" changes the paradigm. Instead of reading the code to understand the business logic, Replay records the real user workflows. By capturing the state changes on the screen and the corresponding data flows, Replay generates a documented React component and the underlying API contracts automatically.

Executing RPG Modernization Moving Logic to React#

To move high-volume settlement logic without breaking the financial chain, we must treat the legacy system as a "Video Source of Truth." Replay allows architects to record a settlement clerk performing a complex reconciliation. The platform then deconstructs that recording into its constituent parts: the data model, the validation rules, and the UI components.

Step 1: Workflow Capture and Recording#

Instead of a developer spending weeks interviewing subject matter experts (SMEs), the SME simply performs their daily tasks while Replay records the session. This isn't a simple screen recording; it's a deep-state capture of the application's behavior.

Step 2: Visual Reverse Engineering and Extraction#

Replay’s AI Automation Suite analyzes the recording to identify patterns. It recognizes that a specific input field on the green screen corresponds to a "Merchant ID" and that a specific function key triggers a "Settlement Calculation."

Step 3: Generating Modern React Components#

Once the logic is understood, Replay generates functional, documented React components. These aren't just "shells"; they are integrated with the business logic extracted from the RPG environment.

typescript
// Example: Generated React component from RPG Settlement Screen extraction import React, { useState, useEffect } from 'react'; import { SettlementService } from './services/settlement'; import { Button, Table, Alert } from '@/components/ui'; /** * @name MerchantSettlementReconciliation * @description Extracted from RPG IV Module SETL004R * @logic Preserves 30-day rolling reserve calculation */ export const MerchantSettlementReconciliation: React.FC<{ merchantId: string }> = ({ merchantId }) => { const [batchData, setBatchData] = useState<any>(null); const [error, setError] = useState<string | null>(null); // Business logic preserved: Net = (Gross - Interchange - ServiceFee) const calculateNetSettlement = (gross: number, interchange: number, fee: number) => { return gross - interchange - fee; }; useEffect(() => { SettlementService.getPendingBatch(merchantId) .then(setBatchData) .catch(err => setError('Failed to retrieve legacy batch data')); }, [merchantId]); if (error) return <Alert variant="destructive">{error}</Alert>; if (!batchData) return <div>Loading Settlement Data...</div>; return ( <div className="p-6 bg-white rounded-lg shadow-md"> <h2 className="text-xl font-bold">Settlement for Merchant: {merchantId}</h2> <Table data={batchData.transactions} /> <div className="mt-4 font-mono text-sm"> Extracted Logic: {calculateNetSettlement(batchData.total, batchData.interchange, batchData.fees)} </div> <Button onClick={() => SettlementService.finalize(batchData.id)}> Finalize Settlement </Button> </div> ); };

⚠️ Warning: Never attempt to "clean up" business logic during the initial extraction phase. The goal of rpg modernization moving is functional parity. Optimization should only happen once the logic is safely running in the modern environment with E2E tests.

Maintaining 0% Error Rates with Generated API Contracts#

In merchant settlement, a rounding error of $0.001 can result in a million-dollar discrepancy across a billion transactions. Traditional manual rewrites fail here because developers often overlook the specific way IBM i handles decimal precision (Packed Decimal).

Replay mitigates this by generating API contracts and E2E tests directly from the legacy interaction. It defines the exact input/output schema required to maintain parity with the RPG back-end.

typescript
// Generated Zod Schema for Settlement API Contract import { z } from 'zod'; export const SettlementSchema = z.object({ merchant_id: z.string().min(10).max(15), transaction_count: z.number().int(), gross_amount: z.number().multipleOf(0.01), interchange_fees: z.number().multipleOf(0.01), // Ensuring precision matches RPG IV 'P' (Packed Decimal) specifications net_settlement: z.number().multipleOf(0.01), currency_code: z.enum(['USD', 'EUR', 'GBP']), settlement_date: z.string().datetime(), }); export type SettlementRequest = z.infer<typeof SettlementSchema>;

Step 4: Technical Debt Audit and Validation#

Before the new React component goes live, Replay provides a Technical Debt Audit. This report highlights which parts of the legacy logic were fully captured and which parts require manual review. This transparency is vital for regulated environments like Financial Services and Healthcare, where SOC2 and HIPAA compliance are mandatory.

💡 Pro Tip: Use Replay’s "Blueprints" editor to map legacy database fields to modern JSON structures visually. This bridges the gap between DB2/400 and modern PostgreSQL or MongoDB instances.

From Black Box to Documented Codebase#

The true value of rpg modernization moving with Replay isn't just the code—it's the understanding. Most enterprises are operating in the dark. They have systems that work, but they don't know why they work.

By using Video as the source of truth, Replay creates a "Library" (Design System) and "Flows" (Architecture) that serve as permanent documentation. If a settlement rule changes next year, you don't need to find an RPG developer; you can look at the visual flow in Replay and see exactly how the logic was constructed during the migration.

Key Features of the Replay Platform:#

  • Visual Reverse Engineering: Record workflows, get React components.
  • AI Automation Suite: Automatically identifies business logic and data patterns.
  • E2E Test Generation: Ensures the new system behaves exactly like the old one.
  • On-Premise Availability: Essential for sensitive financial data and government regulations.

Overcoming the "Cultural Debt" of Modernization#

Modernization is as much a people problem as a technical one. RPG developers are often protective of their systems, fearing that a rewrite will lead to instability. Conversely, modern React developers find the green screen environment alien and frustrating.

Replay acts as a translator. It allows the RPG experts to contribute their knowledge by simply "showing" the system's behavior through recordings, while giving React developers the TypeScript/React code they need to be productive. This collaborative approach reduces the friction that typically derails 70% of legacy projects.

Frequently Asked Questions#

How long does RPG modernization moving take with Replay?#

While a traditional manual rewrite of a merchant settlement module takes 18-24 months, Replay typically completes the extraction and component generation phase in 2-8 weeks. This allows for rapid prototyping and iterative deployment.

How does Replay handle complex RPG business logic like interest calculations?#

Replay doesn't just look at the UI; it monitors the data state changes during a recording. By analyzing the inputs and the resulting outputs, Replay’s AI Automation Suite can infer the underlying logic and generate corresponding TypeScript functions that mirror the legacy calculations with 100% precision.

Is Replay secure enough for Financial Services?#

Yes. Replay is built for regulated environments. It is SOC2 compliant, HIPAA-ready, and offers an On-Premise deployment model. This ensures that sensitive merchant data never leaves your secure infrastructure during the reverse engineering process.

What happens to the original RPG code?#

The original code remains intact. Replay facilitates a "side-by-side" or "strangler" migration where the new React front-end can communicate with the existing RPG back-end via generated API contracts, or the logic can be fully migrated to a new Node.js/Java microservice.

Can Replay document systems that have no existing documentation?#

Absolutely. This is the core strength of the platform. Since Replay uses "Video as the source of truth," it creates documentation based on how the system actually behaves in production, rather than relying on outdated manuals or missing comments.


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