Back to Blog
February 21, 2026 min readas400 supply chain apps

AS/400 RPG Supply Chain Apps: Moving Legacy Green Screens to React Hooks

R
Replay Team
Developer Advocates

AS/400 RPG Supply Chain Apps: Moving Legacy Green Screens to React Hooks

Your supply chain is running on a 30-year-old "black box" that no one currently on your payroll fully understands. While the IBM i (AS/400) remains a legendary workhorse for reliability, the Green Screens (5250 interfaces) powering your as400 supply chain apps have become a catastrophic bottleneck for talent acquisition and digital agility. Every time a veteran RPG developer retires, a piece of your institutional knowledge vanishes.

Modernizing these systems isn't just about aesthetics; it's about survival in a world of $3.6 trillion in global technical debt. The traditional path—a manual rewrite—is a suicide mission. Industry data shows that 70% of legacy rewrites fail or exceed their timelines, often stretching past the 18-month mark before a single production feature is shipped.

Replay offers a different path: Visual Reverse Engineering. By recording your existing workflows, you can bypass the "documentation gap" (which affects 67% of legacy systems) and move directly to a modern React architecture.

TL;DR: Modernizing as400 supply chain apps manually takes 40 hours per screen. Using Replay, that time is slashed to 4 hours. This guide outlines how to extract business logic from RPG subfiles and encapsulate it into modern React Hooks and functional components without losing the data integrity of the IBM i backend.


The Architectural Debt of AS/400 Supply Chain Apps#

The core issue with as400 supply chain apps isn't the DB2 database—it's the tight coupling of business logic and display logic within RPG programs. In a classic 5250 environment, the RPG program controls the cursor, the screen indicators, and the data validation in a monolithic loop.

According to Replay's analysis, the average enterprise supply chain module contains over 200 distinct screens, most of which lack any form of technical documentation. When you attempt to modernize these manually, your developers spend 80% of their time "archaeologizing" code rather than writing new features.

Visual Reverse Engineering is the process of recording real user interactions within legacy UIs to automatically generate documented React components and state machines, effectively mapping the "implied" logic of the green screen to modern code.

Manual Rewrite vs. Replay Modernization#

FeatureManual RewriteReplay Visual Reverse Engineering
Average Time per Screen40 Hours4 Hours
Documentation Requirement100% Manual MappingAutomated from Recordings
Risk of Logic LossHigh (Human Error)Low (Observed Behavior)
Timeline (200 Screens)18–24 Months4–8 Weeks
Success Rate30%>90%

Step 1: Deconstructing the RPG Subfile Logic#

In the world of as400 supply chain apps, the "Subfile" (SFL) is the king of UI patterns. Whether it’s an inventory lookup, a list of pending shipments, or a warehouse pick-list, the subfile handles the display of multiple records.

To move this to React, we must decouple the data fetching from the display. In RPG, you might have a

text
READE
or
text
DOU
loop that populates the subfile. In React, we want to encapsulate this into a custom Hook.

Industry experts recommend treating the legacy terminal as a "Source of Truth for Behavior" while treating the API as the "Source of Truth for Data." Using Replay's Flows, you can map how a user navigates from a "Work with Orders" screen into a "Detail" screen, capturing the exact state transitions required.

The RPG-to-Hook Mapping#

  • Indicator 03 (Exit): Maps to a navigation
    text
    push
    or
    text
    back
    function.
  • Indicator 12 (Cancel): Maps to state reset.
  • Subfile Control Record: Maps to the Hook's
    text
    loading
    ,
    text
    error
    , and
    text
    pagination
    state.
  • Subfile Record: Maps to an array of objects in the
    text
    data
    state.

Step 2: Building the Custom React Hook for Supply Chain Data#

When modernizing as400 supply chain apps, the goal is to create a reusable logic layer. We don't want to just "scrape" the screen; we want to build a headless logic container that can power a web app, a mobile scanner, or an automated kiosk.

Here is how we translate a standard inventory inquiry subfile into a TypeScript React Hook.

typescript
// useInventoryLookup.ts import { useState, useEffect, useCallback } from 'react'; import { InventoryItem, InventoryFilters } from '../types/supply-chain'; import { inventoryApi } from '../api/inventory'; /** * Hook derived from legacy RPG 'INV_LOOKUP' subfile logic. * Replaces the manual indicator-based state management. */ export const useInventoryLookup = (initialWarehouse: string) => { const [items, setItems] = useState<InventoryItem[]>([]); const [loading, setLoading] = useState<boolean>(false); const [error, setError] = useState<string | null>(null); const [filters, setFilters] = useState<InventoryFilters>({ warehouse: initialWarehouse, sku: '', status: 'ACTIVE' }); const fetchInventory = useCallback(async () => { setLoading(true); try { // Replaces the RPG CHAIN/READE logic const response = await inventoryApi.getInventory(filters); setItems(response.data); setError(null); } catch (err) { setError('Failed to fetch inventory from IBM i backend.'); console.error(err); } finally { setLoading(false); } }, [filters]); useEffect(() => { fetchInventory(); }, [fetchInventory]); const updateFilters = (newFilters: Partial<InventoryFilters>) => { setFilters(prev => ({ ...prev, ...newFilters })); }; return { items, loading, error, updateFilters, refresh: fetchInventory }; };

This Hook abstracts away the complexity of the data source. Whether the backend is still an RPG program exposed via a REST wrapper or a modernized microservice, the React UI remains clean and functional. For more on this transition, see our article on Legacy to React Architecture.


Step 3: Designing the Modern Component Library#

One of the biggest hurdles in modernizing as400 supply chain apps is the loss of "keyboard-first" efficiency. Warehouse workers can fly through green screens using only the numeric keypad and function keys. A mouse-heavy web app will actually decrease their productivity.

Using the Replay Library, you can generate a Design System that prioritizes these legacy UX patterns—like F-key shortcuts and rapid data entry—within a modern React framework.

Example: The Pick-List Component#

This component uses the Hook we created and adds keyboard listeners to mimic the "F-key" functionality users expect from the AS/400.

tsx
// InventoryList.tsx import React from 'react'; import { useInventoryLookup } from '../hooks/useInventoryLookup'; import { useKeyboardShortcuts } from '../hooks/useKeyboardShortcuts'; export const InventoryList: React.FC = () => { const { items, loading, updateFilters, refresh } = useInventoryLookup('WH-01'); // Mapping F5 to Refresh - a standard AS/400 pattern useKeyboardShortcuts({ 'F5': () => refresh(), 'F3': () => window.history.back(), }); if (loading) return <div className="spinner">Accessing DB2...</div>; return ( <div className="supply-chain-container"> <header> <h1>Warehouse Inventory</h1> <button onClick={() => updateFilters({ status: 'PENDING' })}> View Pending (F6) </button> </header> <table> <thead> <tr> <th>SKU</th> <th>Description</th> <th>On Hand</th> <th>Location</th> </tr> </thead> <tbody> {items.map(item => ( <tr key={item.id} className="subfile-row"> <td>{item.sku}</td> <td>{item.description}</td> <td>{item.qty}</td> <td>{item.binLocation}</td> </tr> ))} </tbody> </table> </div> ); };

Step 4: Leveraging AI Automation for Mass Conversion#

With 200+ screens, you cannot afford to write every Hook and Component by hand. This is where the Replay AI Automation Suite becomes the central pillar of your strategy.

Instead of manual coding, you record a user performing a "Transfer Order" workflow. Replay’s AI analyzes the video, identifies the input fields, the validation logic (e.g., "Cannot ship more than On-Hand quantity"), and the navigation flow. It then outputs a structured Blueprint that can be exported as production-ready React code.

This process reduces the per-screen effort from 40 hours to just 4 hours. In a typical supply chain modernization project, this represents a 70% average time savings, allowing you to finish in weeks what would otherwise take years.


Overcoming Regulated Environment Hurdles#

Modernizing as400 supply chain apps in industries like Healthcare, Insurance, or Government requires more than just code—it requires compliance. Legacy systems often stay legacy because of the fear that a rewrite will break SOC2 or HIPAA compliance.

Replay is built for these environments. The platform is SOC2 compliant, HIPAA-ready, and offers an On-Premise deployment model. This ensures that your sensitive supply chain data—including vendor contracts and PHI (Protected Health Information) in medical supply chains—never leaves your secure perimeter during the reverse engineering process.


The Strategic Advantage of Visual Reverse Engineering#

The "Rip and Replace" strategy is dead. The "Visual Reverse Engineering" strategy is the future of enterprise architecture. By focusing on the observable behavior of your as400 supply chain apps, you eliminate the need to decipher spaghetti RPG code.

  1. Capture: Record the "Golden Path" of your supply chain workflows.
  2. Analyze: Let Replay identify the underlying data structures and state transitions.
  3. Generate: Export documented React components and TypeScript Hooks.
  4. Iterate: Enhance the UI with modern features like real-time maps, barcode scanning integrations, and AI-driven demand forecasting.

For a deeper dive into how this works in a production environment, check out our guide on Visual Reverse Engineering for Enterprise.


Frequently Asked Questions#

Can Replay handle complex RPG logic like conditional indicators?#

Yes. According to Replay's analysis, most conditional logic in RPG is reflected in the UI's behavior (e.g., a field becoming protected or a color changing). Replay captures these state changes during the recording phase and maps them to conditional rendering logic in your React components.

Do we need to modify our IBM i (AS/400) backend to use Replay?#

No. Replay works by observing the user interface. It doesn't require any changes to your legacy RPG code or DB2 schemas. Once you have the React frontend, you can connect it to your IBM i via existing APIs (like IBM i Access REST API) or middleware.

How does Replay handle keyboard-intensive warehouse workflows?#

Replay's AI identifies common keyboard patterns used in as400 supply chain apps. The generated code can include automatic event listeners for Function keys (F1-F24), ensuring that warehouse staff can maintain their high-speed data entry without needing to switch to a mouse.

What happens if our legacy system has no documentation?#

This is the primary use case for Replay. Since 67% of legacy systems lack documentation, Replay creates the documentation for you by observing the system in action. The resulting "Blueprints" serve as the new technical source of truth for your modernized application.

Is Replay a "Low-Code" platform?#

No. Replay is a Visual Reverse Engineering platform that generates high-quality, human-readable TypeScript and React code. Unlike low-code platforms that lock you into a proprietary runtime, Replay gives you full ownership of the source code, which you can then maintain in your own Git repositories.


Ready to modernize without rewriting? Book a pilot with Replay and see how we can convert your legacy green screens into a modern React architecture in a fraction of the time.

Ready to try Replay?

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

Launch Replay Free