Skip to content

Logistics and distribution

Legacy AS/400 (IBM i) ERP at distributors: extracting decades of history

By SourceX Editorial · Updated

Short answer

AS400 data extraction at a distributor works best through SQL access to Db2 for i, with every file's field definitions, code values and date formats documented before the system is retired. The decision rule: extract full tables rather than reports, and treat field documentation as part of the deliverable, because old codes become unreadable once the last expert leaves.

Key takeaways

  • Business data on IBM i lives in Db2 for i tables, often called physical files, which standard SQL tools can read.
  • Extract full tables rather than reports, so history can be queried in new ways later.
  • Packed decimals, EBCDIC text, numeric dates and single-letter codes are where extracted data usually goes wrong.
  • Field documentation, code tables and control totals belong in the archive next to the data.
  • The people who know what the codes mean are the scarcest resource, so capture their knowledge first.

What is inside an AS/400 ERP after decades of use?#

An AS/400 ERP at a long-running distributor usually holds the company's commercial memory: customer and ship-to masters, item files, pricing matrices, order headers and lines, invoice history, purchase orders, receipts, AR and AP, and note files attached to orders and accounts. Some distributors run packaged software such as JD Edwards World or Infor XA; many run custom RPG systems built and extended in-house.

The data sits in Db2 for i, the database built into IBM i, organized into libraries and physical files. Logical files act as indexes and views over them. Business rules, such as what a status code means or how a contract price is derived, often live in RPG programs rather than in the data itself.

That last point shapes the whole project. Pulling the tables out is the easy part; keeping their meaning is the hard part.

Extraction options compared#

Extraction routes range from direct SQL to partner archive services, and most projects combine two. The table compares the common choices for a distributor retiring or shrinking its IBM i footprint.

Whichever route you choose, extract full physical files rather than report output. A report reflects one question asked once; a table lets an analyst ask new questions years later.

Extraction options compared
MethodHow it worksBest forWatch out for
SQL over ODBC or JDBCQuery Db2 for i tables through IBM i Access Client Solutions or another client and write to files or a databaseFull table extracts with type conversion handled by the driverLong queries against production; character conversion settings
CPYTOIMPF to the IFSA native IBM i command copies a file to a delimited stream file in the integrated file systemQuick exports an operator can runDate and decimal formatting options; multi-member files
Replication or change data capture toolsThird-party software streams tables to a modern databaseSystems that stay live through a long transitionLicense cost and setup effort
Spool files and printed reportsReport output captured as text or PDFEvidence of what customers and users sawNot reusable as data; summaries hide detail
Partner archive serviceAn IBM i partner extracts and documents data into an archive platformTeams without in-house IBM i skillsMake sure you own the output and its documentation
  1. 01Your work records
  2. 02Personal details removed
  3. 03You approve the release
  4. 04Licensed to AI developers
How it works with SourceX: Your work records → Personal details removed → You approve the release → Licensed to AI developers.Illustrative

Why old codes become unreadable#

Old codes become unreadable because AS/400 systems were built to save space and to be read by the programs that wrote them. Field names are short, many values are single characters, and the meaning sits in program logic or in one person's memory.

The traps below account for most broken extracts. Each has a simple fix if someone catches it before the archive is signed off, and an expensive one if it surfaces after the system is gone.

Why old codes become unreadable
TrapWhat goes wrongFix during extraction
Abbreviated field namesNobody can tell which amount or date a column holdsPull text descriptions and confirm meanings with users
Packed and zoned decimalsAmounts lose precision or signLet the driver convert types and spot-check totals
EBCDIC text and CCSIDAccented names and symbols turn into garbageConfirm each file's CCSID and test special characters
Numeric datesDates sort wrongly or read as plain numbersDocument each format and convert to real dates
Codes that changed meaningOld and new records are read the same wayRecord each code's meaning with its date range
Multi-member filesBranches, companies or periods are silently missedList every member and extract each one
Purged historyThe archive starts later than people assumeNote purge dates and earliest records per file

A field documentation checklist#

A field documentation checklist turns each extracted file into something a new analyst can read without the original programmer. Build it file by file, starting with the tables that carry orders, invoices, customers and pricing.

  • Library, file and record format name, with a plain description of what one row represents.
  • Each field's name, text description, type, length and decimal positions, taken from DSPFFD output or the SQL catalog.
  • Character encoding for text fields and how it was converted.
  • Date and time format for every date-like field, with worked examples.
  • Every code value and its meaning, with the period when that meaning applied.
  • Keys and relationships between files, from DSPDBR, logical files and program logic.
  • Which programs write the file and which business rules they apply.
  • Known gaps: purges, archived periods, branches added or merged, and fields no longer maintained.
  • Control totals for validation, such as sales by year or order counts by branch from trusted reports.

Sequence the extraction so people trust it#

An extraction earns trust when it is inventoried, frozen, validated and archived in that order. Skipping validation is a common reason finance and sales later doubt old history and stop using it.

Start with an inventory of libraries and files, and sort business data from work files and system objects. Extract a stable point in time, ideally after a period close. Validate each table against control totals from reports users already trust, then store the data, the documentation and the validation results together under a named owner.

If the IBM i system keeps running during a transition, decide whether the archive is a single snapshot or a series of extracts, and label each with its cut-off so nobody mixes them.

Illustrative: a supply distributor before its programmer retires#

Illustrative: a fictional family-owned janitorial and packaging supply distributor has run a custom RPG order and billing system on IBM i since its founder's time. Its only in-house programmer plans to retire, and the company is moving to a cloud ERP.

The IT director scopes the archive around orders, invoices, customers, items, pricing and order notes. A contractor extracts full tables over JDBC to Parquet files while the programmer documents codes, date formats and the logic behind contract pricing. Control totals by year match the old sales reports.

The new ERP receives only open items and current masters. The archive and its data dictionary become the reference for pricing disputes and demand analysis, and the owners can later assess the history for other uses without keeping the old machine.

What decades of history can be worth#

Decades of distributor history matter beyond the migration: demand patterns across economic cycles, pricing behavior through cost swings, and order notes that show how inside sales handled substitutions, shortages and rush orders. For AI developers building ordering and pricing agents, long, linked and documented histories are hard to find.

The SourceX Enterprise Data Value Framework counts scale, domain expertise and data cleanliness in a record set's favor, and recency matters too, so older years add the most when they connect to recent ones. Preparation cost reduces net value, which is why a documented archive beats a raw dump. Rights still come first: customer contracts and confidentiality terms are reviewed in the Rights step of the SourceX five-step transaction before anything is in scope, and the company approves every step.

Frequently asked questions

Can we extract data without the original ERP vendor?

Usually yes. The data sits in Db2 for i, which standard SQL tools can read with appropriate credentials. The vendor or an IBM i partner may still help explain package-specific tables and codes, which is where most of the effort goes.

Should we convert EBCDIC text ourselves?

Let the ODBC or JDBC driver or the native export command handle conversion where possible, and confirm each file's CCSID. Test with records containing special characters, such as accented customer names, before running full extracts.

Do we need to keep the IBM i machine after the archive is built?

Not if the archive is complete, validated and documented, and no contract or legal hold requires the original system. Some companies keep a powered-down system image as a fallback for a period. Decide with your auditors and counsel, then document the retirement.

Is extracting decades of data a security risk?

It can be, because extracts concentrate sensitive records in new files. Limit who runs extracts, encrypt archive storage, remove working copies from desktops, and log who accesses the archive afterward.

Are spool files worth keeping?

Some are. Statements, invoices or reports that show what customers actually received can serve as evidence. Keep them as documents beside the data archive, but do not treat them as a substitute for the tables.

Related resources

See if your company qualifies

A short company assessment. No data uploads are needed.

See if your company qualifies