If you have ever stared at a dusty fixed-format RPG III program from the 1990s and thought “there has to be a better way”, then IBM’s latest AI-powered sidekick might just be your new best friend.
Meet IBM BOB (yes, that’s the official name now – Project Bob has grown up). BOB is IBM’s AI-first development partner, built right into a VS Code based IDE and tuned specifically for IBM i workloads. It understands RPG, RPGLE, SQLRPGLE, CL, DDS, and a bunch more. Its super-power? Taking scary old legacy code and helping you drag it kicking and screaming into the modern free-format world without losing your sanity (or your job).
Why Bob feels like royalty for modernization
Traditional modernization projects usually involve weeks of head-scratching, lots of coffee, and the occasional GOTO-induced nightmare. Bob changes the game by:
- Explaining what that mysterious subroutine actually does (in plain English, not RPG-ese)
- Suggesting smart refactors, fixed-to-free, extracting procedures, adding proper error handling
- Generating missing display files or service programs based on context
- Helping you convert embedded SQL the right way
It is like having a very clever junior developer who never sleeps, never complains about your variable names, and actually knows the difference between RPG III and ILE.
Is IBM BOB really the undisputed monarch of IBM i code modernization, ruling over legacy systems with a mighty keyboard and a crown of neatly optimized syntax?
The fun part is watching Bob in action
I could bore you with more static code samples, but nothing beats seeing it live. Come with me while I fire up Bob, feed him a genuine piece of 1990s RPG code (complete with GOTO tags and monolithic subroutines), and let the AI loose.
Let’s test BOB’s mettle, by also asking him to take this old RPG400 program (written in the 1990’s) and ask for it to be upgraded to RPGLE /FREE and SQL RPGLE /FREE:
In the video above you just saw:
- The original fixed-format mess
- Bob analysing the logic
- Step-by-step modernization to clean free-format RPGLE and SQL RPG
- Subprocedures, better variable names, and even a few safety improvements
It is not magic, you still review and approve every change, but it sure feels close when Bob suggests a refactor that would have taken you half a day.
Here is BOB’s review of the upgrades it did:
RPGLE – BOB Code Modernization Complete
- Code Readability & Maintainability
Eliminated all fixed-format code – Converted remaining C-specs to fully free-format RPG
Removed GOTO statements – Replaced with structured return statements for cleaner flow
Added control options – ctl-opt with modern settings
Qualified data structure – sourceRecord qualified prevents naming conflicts
Descriptive variable names – Changed file→pFileName, part→pPartnerName, rtn→pReturnCode
Named constants – RC_SUCCESS, RC_PARTNER_MISMATCH, etc. replace magic strings
Enhanced documentation – Clear purpose, return codes, and history - Performance Optimization
Proper file handling – Added usropn and explicit close operations
Early exit strategy – return immediately when match found
Efficient EOF checking – %eof() built-in function instead of indicators - Best Practices & Patterns
Modern parameter interface – dcl-pi replaces entry plist Procedure-based design – main() procedure for better organization Activation group control – actgrp(caller) for proper resource management
Eliminated indicators – Removed *in50, *inlr in favor of modern constructs
Removed obsolete directives – Eliminated /free and /end-free tags - Error Handling & Edge Cases
File empty check – Explicit handling with RC_FILE_EMPTY
Resource cleanup – File properly closed in all exit paths
Success return code – Added RC_SUCCESS for complete match
Clear logic flow – Nested conditions simplified with early returns
The code is now production-ready, maintainable, and follows modern RPG IV best practices.
SQLRPGLE – BOB’s Key SQL Improvements
- Embedded SQL Instead of Native I/O
No file declarations – Uses SQL queries instead of dcl-f
Direct data access – select statements replace READ operations
SQL cursor – declare c1 cursor for efficient record retrieval - Performance Benefits
Optimized query – fetch first 1 row only stops after finding match
SQL filtering – where substr() clauses reduce data retrieval
Count check – select count(*) efficiently checks for empty file
Database optimization – Leverages DB2 query optimizer - Enhanced Error Handling
SQL state checking – sqlState variable monitors all SQL operations
New error code – RC_SQL_ERROR for SQL failures
Proper cursor cleanup – close c1 in all exit paths
No data handling – Explicit check for sqlState = ‘02000’ - Modern SQL Features
String functions – substr() for field extraction
Column aliases – Named result columns for clarity
Declarative approach – SQL describes what to retrieve, not how
Set-based operations – More efficient than record-level processing - Advantages Over Native I/O
Database independence – Can work with any SQL-accessible file
Better scalability – SQL optimizer handles large datasets efficiently
Easier maintenance – SQL queries are more readable than I/O operations
Modern skillset – SQL knowledge is more transferable
You can grab the code samples here
My verdict so far
Is Bob the undisputed king of IBM i code modernization? It is certainly wearing the crown right now. It will not replace your brain (thank goodness), but it removes a huge amount of the grunt work and lets you focus on the interesting bits – architecture, business logic, and making the application actually better instead of just “less ancient”.
If you are sitting on a mountain of legacy RPG, now is a great time to give IBM BOB a spin. Start small: pick one program, ask it to explain the code, then try a controlled refactor. You will be amazed how quickly those old monsters start looking friendly again.
Got your own terrifying legacy program you want to modernize? Drop a comment below, I might even feature it in a future video.
Happy coding (and modernizing)!

