Back to Blog
February 17, 2026 min readmanufacturing mapping hidden logic

RPG for Manufacturing: Mapping Hidden Logic in AS/400 Production Lines

R
Replay Team
Developer Advocates

RPG for Manufacturing: Mapping Hidden Logic in AS/400 Production Lines

The most critical logic in your manufacturing facility isn't in your modern IoT sensors; it’s buried in an RPG subfile written in 1994. While the IBM i (AS/400) remains the "Old Reliable" of the factory floor, its green-screen interface has become a black box. For enterprise architects, the challenge isn't just moving to the cloud—it's the grueling process of manufacturing mapping hidden logic from legacy systems that no longer have living documentation.

With a global technical debt mountain reaching $3.6 trillion, manufacturing leaders are realizing that manual rewrites are a path to failure. When you have 2,000 screens controlling everything from Bill of Materials (BOM) to shop floor scheduling, you can't afford the 18-month average enterprise rewrite timeline. You need a way to extract the "how" and "why" of your production lines without stopping the line.

TL;DR: Manufacturing legacy systems (AS/400/RPG) suffer from "Indicator Soup" and missing documentation. Manual migration takes 40 hours per screen and has a 70% failure rate. Replay uses Visual Reverse Engineering to convert video recordings of legacy workflows into documented React components and Design Systems, reducing modernization time by 70%.


The Complexity of Manufacturing Mapping Hidden Logic#

In a typical RPG-based manufacturing environment, the business logic is inextricably tied to the display files (DSPF). Unlike modern architectures where the UI is a thin layer over an API, legacy RPG often embeds critical production rules—like lead time calculations or scrap rate adjustments—directly into the screen's indicator logic.

Manufacturing mapping hidden logic involves more than just reading source code. It requires understanding how a floor manager interacts with a specific sequence of "Function Keys" to override a production halt. According to Replay's analysis, 67% of these legacy systems lack any form of up-to-date documentation, meaning the "source of truth" exists only in the minds of retiring engineers and the flickering green text of the terminal.

The "Indicator Soup" Problem#

In Fixed-Format RPG, indicators (01-99) control everything. An indicator might signify a "Record Not Found" error, but in a complex manufacturing ERP, it might also trigger a secondary calculation for warehouse bin allocation. Mapping this logic manually requires a forensic level of effort that most organizations cannot sustain.

Video-to-code is the process of converting screen recordings of legacy software interactions into clean, documented, and functional modern codebases using computer vision and LLMs.

By using Replay, architects can record these complex workflows. Replay’s AI Automation Suite analyzes the visual state changes, mapping the underlying business rules to modern TypeScript structures.


Manual Migration vs. Visual Reverse Engineering#

The traditional approach to modernization involves hiring a "Tiger Team" of RPG developers and React consultants. They sit together for months, trying to decipher what happens when a user hits

text
F21
on the "Work Order Entry" screen.

MetricManual MigrationReplay Visual Reverse Engineering
Time per Screen40 Hours4 Hours
Documentation Status67% Missing/Incomplete100% AI-Generated & Verified
Average Timeline18–24 Months4–12 Weeks
Failure Rate70% (Industry Average)< 5%
Cost BasisHigh (Specialized Talent)Optimized (Automation-First)

Industry experts recommend moving away from "rip-and-replace" strategies. Instead, a documented modernization strategy focuses on capturing the existing functional footprint before writing a single line of new code.


Automating Manufacturing Mapping Hidden Logic with Replay#

When we talk about manufacturing mapping hidden logic, we are specifically looking for the "invisible" rules. For example, why does the "Available to Promise" (ATP) date change when the shift pattern is updated? In an AS/400 system, that logic might be spread across three different physical files and five RPG programs.

Replay simplifies this through its core features:

  1. Flows: Map the end-to-end architecture of your production line by simply recording the process.
  2. Library: Automatically generate a Design System that mirrors your functional requirements but uses modern React components.
  3. Blueprints: A visual editor to refine the extracted logic before it's exported to your codebase.

Example: Converting a Work Order Subfile to React#

Consider a standard RPG subfile used for tracking production orders. In the legacy system, this is a rigid grid. When manufacturing mapping hidden logic, we need to ensure the new React component respects the validation rules (e.g., "Quantity cannot exceed Raw Material availability").

Here is how that logic is transformed into a modern, type-safe React component using the patterns generated by Replay:

typescript
// Generated via Replay AI Automation Suite import React, { useState, useEffect } from 'react'; import { WorkOrderSchema, WorkOrderType } from './types/production'; import { useProductionLogic } from './hooks/useProductionLogic'; const WorkOrderGrid: React.FC = () => { const [orders, setOrders] = useState<WorkOrderType[]>([]); const { validateQuantity, calculateLeadTime } = useProductionLogic(); const handleUpdate = (id: string, qty: number) => { // This logic was extracted from RPG Indicator 42 (Over-capacity check) if (!validateQuantity(qty)) { alert("Warning: Order exceeds station capacity."); return; } // Update logic mapped from legacy 'UPDAT' operation setOrders(prev => prev.map(o => o.id === id ? { ...o, quantity: qty } : o)); }; return ( <div className="p-6 bg-slate-50 rounded-lg shadow-md"> <h2 className="text-xl font-bold mb-4">Production Queue</h2> <table className="min-w-full divide-y divide-gray-200"> <thead> <tr> <th>Order ID</th> <th>Quantity</th> <th>Est. Completion</th> </tr> </thead> <tbody> {orders.map(order => ( <tr key={order.id}> <td>{order.id}</td> <td> <input type="number" value={order.quantity} onChange={(e) => handleUpdate(order.id, parseInt(e.target.value))} /> </td> <td>{calculateLeadTime(order.quantity)} days</td> </tr> ))} </tbody> </table> </div> ); };

Mapping the Data Layer#

The real "hidden" part of the logic often resides in the data validation. In the AS/400 world, data integrity was often handled at the program level rather than the database level. When executing manufacturing mapping hidden logic, Replay identifies these constraints by observing how the UI reacts to invalid inputs during the recording phase.

typescript
// TypeScript definition for mapped production logic export interface WorkOrderType { id: string; partNumber: string; quantity: number; status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED'; priorityIndicator: boolean; // Mapped from *IN05 in RPG } export const validateProductionRules = (data: WorkOrderType) => { // Logic extracted from RPG 'C' Specs const isWeekendShift = new Date().getDay() % 6 === 0; if (isWeekendShift && data.quantity > 500) { throw new Error("Weekend throughput cannot exceed 500 units per shift."); } return true; };

Why 70% of Legacy Rewrites Fail#

According to Replay's analysis, the primary reason for failure in manufacturing modernization is "Scope Creep caused by Undiscovered Logic." When you start a rewrite, you assume the system does X. Six months in, you realize it also does Y and Z under specific conditions that were never documented.

By using Visual Reverse Engineering, you eliminate the "discovery gap." You aren't guessing what the code does; you are documenting what the system actually does in production. This shifts the timeline from years to weeks.

Visual Reverse Engineering is the process of extracting functional requirements and UI patterns from existing software by analyzing user interactions and visual outputs rather than just raw source code.

The Financial Impact of Technical Debt#

In manufacturing, technical debt isn't just a line item on an IT budget; it’s a risk to the supply chain. A single bug in a legacy RPG routine during a modernization attempt can halt a production line, costing upwards of $22,000 per minute in industries like automotive or semiconductor manufacturing.

Manufacturing mapping hidden logic through Replay provides a safety net. Because the platform generates code based on proven, recorded workflows, the risk of missing a "hidden" business rule is virtually eliminated.


Implementation Strategy: The Replay Workflow#

To successfully execute manufacturing mapping hidden logic, follow this four-step framework:

  1. Record: Capture real users performing standard tasks on the AS/400 green screens—entering orders, checking inventory, and managing shipments.
  2. Analyze: Replay’s AI Automation Suite parses the video, identifying recurring UI patterns (Subfiles, Command Keys, Message Subfiles) and the underlying state changes.
  3. Map: Use the "Flows" feature to visualize how data moves between screens. This is where the manufacturing mapping hidden logic becomes visible.
  4. Export: Generate a documented React Component Library and a set of clean TypeScript hooks that represent your business logic.

This approach ensures that your new system isn't just a "pretty skin" over old problems, but a modern, scalable architecture that retains the hard-won business intelligence of the last 30 years.


Frequently Asked Questions#

How does Replay handle custom RPG logic that doesn't have a UI?#

While Replay focuses on Visual Reverse Engineering, it excels at capturing the effects of backend logic on the UI. If a specific calculation changes a value on the screen, Replay captures that state transition. For purely headless batch processing, Replay provides the architectural "Flows" that define when and why those batch jobs are triggered, allowing developers to rewrite them with clear context.

Is Replay SOC2 and HIPAA compliant for sensitive manufacturing data?#

Yes. Replay is built for regulated environments including Financial Services, Healthcare, and Government. We offer On-Premise deployment options for manufacturers who cannot allow their production data to leave their internal network, ensuring that your manufacturing mapping hidden logic process remains secure.

Can Replay integrate with my existing CI/CD pipeline?#

Absolutely. The code generated by Replay is standard React and TypeScript. It is designed to be checked into your version control system (Git) and integrated into your existing build processes. Replay doesn't provide a "black box" runtime; it provides the code you would have written yourself, but 10x faster.

What happens if our RPG code is "spaghetti code" with no structure?#

This is exactly where Replay shines. Because we use Visual Reverse Engineering, the quality of the underlying legacy code matters less than the consistency of the user experience. We map the outcomes of the logic. Even if the RPG code is a mess of GOTO statements, the resulting React components will be clean, modular, and functional.


Moving Beyond the Green Screen#

The goal of manufacturing mapping hidden logic is not just to change the color of the screen from green to white. It is to liberate the data and logic that drives your competitive advantage. In an era of "Industry 4.0," you cannot afford to have your most important logic trapped in a system that doesn't speak the language of the modern web.

By reducing the time per screen from 40 hours to just 4 hours, Replay allows manufacturing firms to reclaim their agility. You can move from a legacy AS/400 environment to a modern, cloud-native React stack in a fraction of the time, with 100% confidence that no hidden logic was left behind.

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