Posts

Showing posts from March, 2026

DB2 System Versioning on IBM i – Automatic History Tracking Without Triggers

Image
In this post I'll show you how to implement DB2 System Versioning on IBM i — a built-in mechanism that automatically keeps a full history of every INSERT, UPDATE, and DELETE on a table, without writing a single line of trigger code. This is a practical, working example I built and tested step by step. I'll show you the real errors I ran into and exactly how I fixed them. What You'll Learn How to create a Journal and Journal Receiver with a CL program How to design a main table with temporal columns Why CREATE TABLE ... LIKE doesn't work for history tables (and what to do instead) The correct sequence: create → journal → activate versioning How to verify the history with SELECT queries The Setup: Two Source Members, One CL Program Everything runs from a single CL program ( HISTORY010.CLP ) that orchestrates two SQL script members stored in SQLTBLSRC . The execution sequence is critical and must follow this exact order: Create j...