Canadian National Railway (CN) is one of North America's leading transportation and logistics companies, connecting Canada’s coasts with the U.S. Midwest and Gulf Coast. It transports a broad range of goods, including consumer products, grain, energy, and industrial materials, across an extensive rail network.
lines of code including Natural, COBOL, JCL, DB2 and Adabas
of design knowledge now retiring with the people who built the system
Gleb Geguine
CN's operations run on a z16 mainframe designed about 40 years ago, processing 10 million transactions and 55,000 waybills a day. One of its core systems alone runs to 17.4 million lines of code, and the people who built it are retiring.
AI can generate code, but no context window holds an estate that size. It infers the architecture instead, conflating business and technical perspectives and missing the implied dependencies.
CN treats code generation as the solved part and the reverse-engineering of the legacy system as the real work: capturing its ontology and system contracts by combining SME knowledge, top down, with AI inference, bottom up.
CAST Imaging maps the transaction flows across the system, from entry point to data, and gives AI the context it cannot infer from code alone, exposed to GenAI through MCP.
Instead of reading raw source code, AI works from complete transactions that run from entry point to data in one uninterrupted chain, grounded in the dependencies that actually exist rather than in what a model infers.
Deep discovery of the system continues, and modernization is already underway on the modules where dependencies are mapped. Before a module is touched, the mapped dependencies show the blast radius of a change.