Search on this blog

Search on this blog

AS400 data extraction, getting data out of an IBM i without stopping operations

Many Quebec companies still run their ERP on an AS400. The system is reliable, it has done its job for years, and nobody wants to touch it. The problem comes when management wants up-to-date dashboards, wants to cross sales with the CRM or to prepare its data for artificial intelligence. The data is there, but it trickles out through Excel exports made by hand. This guide explains how to extract data from an AS400 into a cloud data warehouse such as Snowflake, continuously and without stopping operations.

AS400, iSeries, IBM i, what are we talking about?

IBM's AS/400 has been renamed several times. It was called iSeries, then System i. Today, the operating system is called IBM i and runs on IBM Power servers. In most teams, everyone still says "the AS400". The good news for extraction is that the database is built into the system. It is called DB2 for i and it can be read with SQL, like any relational database.

The ERP data lives in physical files, grouped into libraries. For SQL, a physical file is a table and a library is a schema. Names are often short and cryptic, inherited from the RPG language, but each table and each column usually carries a description.

One-off methods, exporting to Excel or CSV

To get data out once, several tools already exist.

  • IBM i Access Client Solutions. Its data transfer tool exports the result of a query to Excel or CSV.
  • The CPYTOIMPF command. It copies a file into a text file on the IFS, the integrated file system, which is then retrieved by FTP or through a network share.
  • ODBC. The ODBC driver that comes with Access Client Solutions lets Excel or Microsoft Query read the tables directly.

These methods help for a report. They do not make a data platform. The export depends on one person, it keeps no history, and it breaks as soon as a field changes. To feed a data warehouse every day, you need automated extraction.

The lasting method, reading DB2 for i with SQL

Automated extraction goes through a driver. The jt400 JDBC driver, published by IBM under an open source licence in the JTOpen project, is the most common in integration tools. It connects to the IBM i database server, on port 8471, and runs read-only SQL queries.

Four points save a lot of time.

  1. The network. The AS400 is almost always on the internal network. It is reached through a VPN or an SSH tunnel that opens a single port, rather than by exposing the server.
  2. The data dictionary. It is often already in the system catalog. The QSYS2.SYSTABLES and QSYS2.SYSCOLUMNS views give the description of every table and every column. No need to wait for documentation that no longer exists.
  3. Duplicate libraries. An ERP that manages several companies or branches often creates one library per entity, with the same tables. They are combined in the warehouse by adding a column that says which library each row comes from, rather than building one integration per entity.
  4. Formats. Dates are often stored as numbers, amounts as packed decimals, and some text fields are flagged as binary. The driver converts most cases. The others are handled by a connection property or in the transformation.

Incremental loading, relying on the journals

Reloading every table each night works at first, then becomes too heavy. Incremental loading only reads what has changed. On an IBM i, the best source for this is often already in place. The ERP's important tables are journaled, and the QSYS2.DISPLAY_JOURNAL function makes the journal readable with SQL.

Each journal entry says what happened. An insert, an update with the before and after images, or a delete. This is what makes it possible to capture deletes, which a simple date comparison never sees. It is also what protects history when the ERP purges its old data. The source forgets, the warehouse keeps.

When a table is not journaled, we look at its dates. A technical date, set by the system at creation or update, allows reliable incremental loading. A business date, such as an invoice date, can be entered after the fact. It is not enough. For small tables without a reliable date, a full reload remains the simplest solution.

Into the warehouse, Snowflake and Matillion

The extracted data first lands as is in a staging area of the warehouse. Transformations come next, in the warehouse, where columns are renamed, dates converted and tables linked together. This separation makes it possible to replay a transformation without querying the AS400 again.

Codex builds these pipelines with Matillion, whose platform is now called Maia Foundation (formerly Data Productivity Cloud), and loads them into a Snowflake data warehouse. A tip from the field. Validate the connection on a real load, not only with the test button. A connection can pass the test and fail on the first load, depending on the version of the embedded driver and of the system.

How to avoid stopping operations

  • A read-only profile. Extraction uses a dedicated profile that only reads the libraries it needs.
  • Nothing to install on the AS400. The JDBC driver talks to the database server that is already there. No program to add, no change to the ERP.
  • Light reads. Incremental loading reads the journal rather than whole tables. Full reloads are scheduled outside peak hours.
  • One step at a time. We start with the tables that feed a first dashboard, check the numbers with the teams, then expand.

The AS400 is only one source among others

Once the ERP is connected, thedata warehouse also receives the CRM, accounting or e-commerce. If the application offers an API, we build the custom connector, even when no ready-made one exists. The AS400 data then becomes part of a complete view, instead of an island queried through Excel exports.

Do you have an AS400 and data to put to work? Let's talk about your project.

Frequently asked questions

Can AS400 data be exported to Excel?

Yes. IBM i Access Client Solutions exports the result of a query to Excel or CSV, and the ODBC driver lets Excel read the tables. It is useful for a one-off report, not to feed a data warehouse every day.

Do you need to install software on the AS400 to extract its data?

No. A JDBC or ODBC driver queries the database server already present on the IBM i. All it takes is a user profile with the necessary read rights and network access.

How do you capture deletes in the AS400?

Through the journal. When a table is journaled, the QSYS2.DISPLAY_JOURNAL function shows deletes as well as inserts and updates. A date comparison does not see them.

ODBC or JDBC, which driver should you choose?

Both read DB2 for i. ODBC suits Windows tools such as Excel. The jt400 JDBC driver is the usual choice for integration tools and scripts, because it runs on every system.

Does extraction slow down the system?

Very little, if it is well designed. Incremental loading reads the journal instead of rereading whole tables, and full reloads run outside peak hours.