Case Study

CN gives AI the right context to modernize a 40-year-old mainframe

Canadian National Railway (CN)

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.

17.4
million

lines of code including Natural, COBOL, JCL, DB2 and Adabas

40
years

of design knowledge now retiring with the people who built the system

CN gives AI the right context to modernize a 40-year-old mainframe

“CAST is a key enabler and does a lot of the heavy lifting for building AI context.”

Gleb Geguine

Chief Enterprise Architect

CN used AI + CAST to reverse-engineer a 40-year-old mainframe, mapping the transaction flows of a 17.4-million-line core system. With AI grounded in the dependencies it cannot infer from code alone, CN is now modernizing modules while discovery continues.

Challenge

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.

Solution

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.

Results

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.