Back to Blog
February 10, 202610 min read400 rpg logic

AS/400 RPG Logic Extraction: Why Telecom Billing Modernization Needs Workflow Recording

R
Replay Team
Developer Advocates

The most expensive code in your telecom stack isn't your new 5G core—it's the 40-year-old RPG logic powering your billing engine. While your competitors launch agile MVNOs in weeks, your enterprise is likely paralyzed by a "green screen" legacy system that no one fully understands, yet everyone is afraid to touch.

In the telecom sector, billing is the ultimate source of truth. It’s where usage data meets complex tax jurisdictions, multi-tier discounting, and regulatory compliance. Most of this intelligence is buried deep within 400 rpg logic—a black box of positional code and cryptic indicators that has survived decades of "modernization" attempts. The industry standard for dealing with this has been a "Big Bang" rewrite, a strategy that carries a 70% failure rate and typically exceeds 24 months in timeline.

We need to stop treating legacy modernization as a code translation problem and start treating it as a workflow extraction problem.

TL;DR: Modernizing telecom billing doesn't require manual RPG code archaeology; by using Replay to record visual workflows, enterprises can extract business logic and generate modern React components in days instead of years.

The High Cost of Manual 400 RPG Logic Extraction#

The $3.6 trillion global technical debt isn't just a number; it’s a daily tax on innovation. For a Tier 1 telecom provider, the logic governing how a roaming charge is calculated or how a corporate discount is applied is often trapped in RPG III or IV programs.

Manual extraction is a nightmare. You hire expensive consultants to sit with "subject matter experts" (SMEs) who are nearing retirement. They spend months documenting what they think the system does. Then, developers spend more months trying to map that documentation to the actual code.

The Documentation Gap#

Statistics show that 67% of legacy systems lack any form of up-to-date documentation. In an AS/400 environment, the "documentation" is often the code itself. But reading 400 rpg logic requires a specific mental model—understanding indicators like

text
*IN03
for exit commands or positional syntax where a single character in column 24 changes the entire operation.

Modernization MetricManual RewriteReplay Reverse Engineering
Average Timeline18 - 24 Months2 - 8 Weeks
Cost per Screen~$4,000 (40 hrs)~$400 (4 hrs)
Risk of FailureHigh (70%)Low (Data-Driven)
DocumentationManual/StaticAutomated/Living
Logic AccuracySubjective100% Observed Reality

Why Telecom Billing Modernization Fails#

Telecom billing systems are uniquely resistant to change because they are "sticky." They aren't just databases; they are massive state machines. When you attempt to extract 400 rpg logic through traditional means, you run into three primary walls:

  1. The Hidden State Wall: RPG programs often rely on global variables and job-level indicators that aren't apparent from looking at a single subroutine.
  2. The Integration Wall: Billing must talk to provisioning, CRM, and external tax engines (like Vertex). A rewrite often breaks these fragile integrations.
  3. The Regulatory Wall: In regulated industries like Telecom and Finance, you cannot afford a "close enough" logic extraction. A 0.01% error in a tax calculation across 10 million subscribers is a multi-million dollar compliance disaster.

⚠️ Warning: Attempting a "Big Bang" rewrite of an AS/400 billing system without a visual source of truth usually results in "Feature Parity Debt," where the new system lacks 20% of the undocumented edge cases that actually keep the business running.

Visual Reverse Engineering: A New Path#

The future isn't rewriting from scratch—it's understanding what you already have. Replay changes the paradigm by using Video as the source of truth.

Instead of reading the RPG source code to guess the business rules, you record a power user performing a billing adjustment or a plan migration. Replay captures every network call, every state change, and every UI transition. It then uses AI to map these visual actions back to the underlying logic, effectively "de-compiling" the user experience into documented React components and API contracts.

Step 1: Workflow Recording#

A billing specialist performs a standard task—for example, applying a pro-rated credit to a disconnected line. Replay records this session, capturing the "Green Screen" interactions and the data flow.

Step 2: Logic Extraction and Blueprinting#

Replay’s AI Suite analyzes the recording. It identifies that when "F9" is pressed, the system validates the credit limit against a specific DB2 table. This is the core of 400 rpg logic extraction: identifying the intent and the result without getting bogged down in the syntax of the legacy language.

Step 3: Generating the Modern Stack#

Once the "Blueprint" is created, Replay generates functional, clean React code. This isn't just a UI skin; it’s a modern component that mirrors the legacy business logic but is built for a cloud-native environment.

typescript
// Example: Generated React component from a Replay extraction // This component replaces a legacy RPG subfile for billing adjustments import React, { useState, useEffect } from 'react'; import { Button, TextField, Alert } from '@telecom-ui/core'; interface BillingAdjustmentProps { subscriberId: string; originalAmount: number; } export const BillingAdjustmentForm: React.FC<BillingAdjustmentProps> = ({ subscriberId, originalAmount }) => { const [adjustment, setAdjustment] = useState<number>(0); const [reasonCode, setReasonCode] = useState<string>(''); const [isValid, setIsValid] = useState<boolean>(true); // Replay extracted this validation logic from the RPG *IN25 indicator check const validateAdjustment = (value: number) => { const MAX_ADJUSTMENT_PERCENT = 0.50; if (value > originalAmount * MAX_ADJUSTMENT_PERCENT) { setIsValid(false); return false; } setIsValid(true); return true; }; const handleSubmit = async () => { if (validateAdjustment(adjustment)) { // API Contract generated by Replay based on legacy DB2 procedures await fetch('/api/v1/billing/adjust', { method: 'POST', body: JSON.stringify({ subscriberId, adjustment, reasonCode }) }); } }; return ( <div className="p-4 border rounded-lg shadow-sm"> <h2 className="text-xl font-bold">Apply Billing Credit</h2> {!isValid && <Alert severity="error">Adjustment exceeds 50% threshold.</Alert>} <TextField label="Adjustment Amount" type="number" onChange={(e) => setAdjustment(Number(e.target.value))} /> <Button onClick={handleSubmit} disabled={!isValid}> Confirm Adjustment </Button> </div> ); };

💰 ROI Insight: By moving from manual extraction to Replay’s automated approach, enterprises reduce the "Time to First Screen" from 6 months to 2 weeks, representing a 70% average time savings.

Preserving Business Logic Without the Archaeology#

When we talk about 400 rpg logic, we are talking about decades of edge cases. In the telecom world, these edge cases are the business.

Consider a "Family Plan" discount logic. Over 20 years, that RPG code has been patched to handle:

  • Military discounts
  • Employee-referee bonuses
  • Seasonal promotions
  • Regional tax exemptions

A manual rewrite almost always misses the "Military discount + Seasonal promotion" overlap logic because it’s buried in a nested

text
IF/ELSE
structure in an RPG member that hasn't been opened since 2012.

Replay doesn't care how messy the code is. By recording the workflow, it captures the outcome of that logic. If the user enters a specific code and the price drops by 15%, Replay documents that requirement. It turns the "black box" into a documented codebase.

Technical Debt Audit#

Before you even write a line of new code, Replay provides a Technical Debt Audit. It maps out your existing flows and identifies which parts of your 400 rpg logic are actually being used.

📝 Note: It’s common to find that 30% of legacy RPG code is "dead code"—logic for products or regulations that no longer exist. Replay helps you avoid migrating this "ghost logic" to your new system.

Implementation Strategy: The Strangler Fig Pattern#

For Telecom VPs of Engineering, the "Strangler Fig" pattern is the gold standard. You don't replace the whole AS/400 at once. You "strangle" it by replacing one functional area at a time—starting with the UI and high-touch workflows.

  1. Identify the Pain Point: Usually the "Customer Care" portal where agents struggle with green screens.
  2. Record with Replay: Capture the 10 most common workflows (e.g., address change, plan upgrade, payment processing).
  3. Generate Blueprints: Use Replay to create the API contracts and React components.
  4. Deploy Side-by-Side: Let agents use the new modern UI while the backend still talks to the AS/400 via generated APIs.
  5. Decommission: Once all workflows for that module are migrated, turn off the legacy screen.
typescript
// Example: Replay-generated API Contract for legacy integration // This allows the modern React UI to communicate with the AS/400 logic /** * @name UpdateSubscriberAddress * @description Extracted from RPG Program ADDR001R * @legacy_system AS/400 iSeries */ export interface LegacyAddressUpdate { SUB_ID: string; // Map to Subscriber ID STR_NUM: string; // Map to Street Number STR_NAME: string; // Map to Street Name POST_CODE: string; // Map to Zip/Postal Code ACTION_CODE: 'U' | 'I'; // Legacy action indicator captured by Replay } export const updateLegacyAddress = async (data: LegacyAddressUpdate) => { // Logic to call the Replay-generated middleware that bridges to DB2 return await legacyBridge.post('/ADDR001R', data); };

Security and Compliance in Regulated Telecom#

Telecom is a high-stakes environment. You are dealing with PII (Personally Identifiable Information) and CPNI (Customer Proprietary Network Information).

Replay is built for these regulated environments:

  • SOC2 & HIPAA Ready: Ensuring data integrity during the extraction process.
  • On-Premise Available: For many telecom providers, data cannot leave the internal network. Replay can be deployed entirely on-premise or in a private VPC.
  • Audit Trails: Every logic extraction is tied back to a recorded session, providing a clear audit trail for compliance officers to see why a certain piece of logic was generated.

Moving Beyond the Green Screen#

The era of the 2-year legacy rewrite is over. The risks are too high, and the market moves too fast. By focusing on 400 rpg logic extraction through visual reverse engineering, telecom providers can reclaim their agility.

Replay allows you to:

  • Document without archaeology: Stop digging through 50,000 lines of RPG.
  • Modernize without rewriting: Keep the parts of your system that work, and wrap them in a modern, scalable architecture.
  • Save 70% on timelines: Move from "maybe next year" to "live next month."

The future of your enterprise isn't hidden in a new cloud suite; it's locked inside your existing systems. Replay is the key to getting it out.

Frequently Asked Questions#

How does Replay handle complex 400 rpg logic that isn't visible on the screen?#

While Replay starts with the visual workflow, its AI Automation Suite analyzes the data payloads and state changes between screens. By observing the inputs and outputs of the "black box," Replay can infer business rules and validations that occur in the background, generating corresponding logic in the modern codebase.

Can Replay work with customized AS/400 environments?#

Yes. Most telecom billing systems are highly customized versions of base software (like older versions of Netcracker or CSG). Because Replay records the actual user workflow, it captures the customized version of your process, not a generic template. This is the core advantage of visual reverse engineering over standard code converters.

What is the average time to modernize a single complex billing screen?#

In a manual environment, documenting, designing, and coding a single complex legacy screen can take upwards of 40 hours. With Replay, that time is reduced to approximately 4 hours—a 90% reduction in manual effort.

Does Replay generate "spaghetti code" during extraction?#

No. Replay generates clean, modular React components and TypeScript interfaces. The AI is trained on modern architectural patterns, ensuring that the output is maintainable, testable, and follows your organization’s design system (Library).

How do we handle data migration while using Replay?#

Replay focuses on the logic and UI layer. However, by generating clear API contracts and data models based on the legacy system's behavior, it provides a roadmap for your data engineering team to map DB2 schemas to modern PostgreSQL or NoSQL databases.


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