Picture a new hire who has read every manual ever written, types faster than anyone in the building, and has never once doubted themselves.
That's AI on IBM i. Some days it's the best teammate we've had. Other days it's cheerfully explaining a system service that does not exist.
Our developers have been using AI in real IBM i work. This page is what we've learned: where it helps, where it gets things wrong, the prompts we use, and how we check its work. Take what's useful.
Why we started
It started with support work. Much of what our team does day to day is resolve issues inside a large ERP system that has been running, and changing, for more than two decades. One screen can sit on top of a chain of five or six programs. A single program in that chain can run past 12,000 lines, with changes layered on by different developers over the years. Some of those changes are documented. Some are more of an oral tradition.
In a system like that, the fix is usually the small part. Three examples:
- One issue we traced through six programs came down to a single setting being read backwards. The correction was two characters.
- Another was not a code problem at all. The program was written correctly, and the cause was a database rule that existed in some environments and was missing in one.
- A third came from two changes made years apart. Each was correct on its own, but they disagreed about how a value was stored, and a payment came out a few cents off.
Finding answers like those means reading a lot of unfamiliar code, forming a theory, testing it, and writing down what we learned so the next person doesn't start from zero. That is slow work, and it's where we first tried AI: to get oriented faster, to challenge our own theories, and to turn what we found into documentation and test plans.
What we found was a tool that's very good at some things and confidently wrong about others. Learning which is which turned out to be the real skill.
Where AI helps
Explaining old RPG. Every IBM i shop has programs written before anyone on the current team was hired. Fixed format, indicators everywhere, six-character field names, no comments. AI can walk through the logic and give a developer a map in minutes instead of an afternoon. It doesn't replace knowing RPG. It tells you where to start looking.
Drafting documentation. Documentation is the job everyone agrees is important, right up until it's time to do it. AI is good at the first draft: what a program does, what goes in and out, and the business rules buried in its conditions. A developer still corrects it, but editing a draft beats staring at a blank page.
Building test data. Describe the layout and the cases you need: a blank date, a negative quantity, a customer with hundreds of open orders, a name with an apostrophe. AI builds the rows, and it's good at suggesting the edge cases nobody listed, which is where bugs tend to live.
Writing SQL. Db2 for i keeps adding services that many shops haven't discovered yet. Asking "how do I see which job is holding a lock on this file?" gets you pointed at QSYS2.OBJECT_LOCK_INFO without a tour of the manuals.
The work around the core system. We've used AI to help build an internal dashboard that shows which support requests are assigned and which are still waiting. An early version would have handed a request to anyone who was greeted by name in an email. Being told "Hi" is not the same as volunteering, so that got fixed. AI also helped draft the formatting guide we use to publish articles on this website, including the one you're reading.
Where it gets things wrong
It invents things. AI will name a service, an API, or a command parameter that doesn't exist, and do it with complete confidence. The name sounds right. The syntax looks right. It isn't real.
It mixes up RPG. It sometimes blends fixed-format and free-format syntax, or writes code for a release your system isn't on. It looks fine until you compile it.
It misses the one thing that matters. On IBM i, the important behavior is often in the details: an indicator set three subroutines earlier, a file override, a value read once at startup. AI can explain a program almost perfectly and skip the line that controls everything.
It doesn't know your system. It knows how things usually work. It has never met your twenty years of business rules.
Our favorite example: on one issue, the early analysis pointed straight at the program. It had to be skipping a step when saving. The program was innocent. It had been written correctly the whole time. The real cause was a database rule missing in one environment, and we only found it by checking what was actually stored, not what the code said should happen.
To be fair, AI isn't the only one whose first theory is wrong. On another issue, our own first move was the IBM i version of turning it off and on again: rebuild the program and retest. The retest came back with exactly the same wrong number. The real cause was two old changes that disagreed with each other, and no amount of rebuilding was going to settle that argument.
The lesson is the same either way. A confident theory is still a theory until you've tested it.
How to ask so you get a useful answer
Most bad AI answers start with a vague question. These five habits fix most of that.
- Give it the context a new teammate would need. Say which IBM i release you're on, whether the code is fixed or free format, and what the program is supposed to do.
- Ask for structure, not a summary. "What does this do?" gets a paragraph. "List the files it reads and updates, the indicators that control the flow, and what each subroutine does" gets something you can check.
- Tell it to admit what it doesn't know. Add "flag anything you're unsure about instead of guessing." It won't catch everything, but it helps.
- Ask one thing at a time. Explain first. Document second. Change third. Mixing them gets you a little of each and not enough of any.
- Make it argue with itself. After it gives a theory, ask "what else could cause this, and how would I rule each one out?" This is the single most useful follow-up we know.
The prompt library
Copy these and fill in the brackets. Each one ends with what to check before you trust the answer.
1. Explain an RPG program
Explain this RPG program step by step. List every file it reads, writes or updates. List the indicators that control the flow and where each one is set. Describe what each subroutine does. Flag anything you are unsure about instead of guessing.
Check: Pick two or three of its claims and confirm them in the source yourself. If those hold up, the rest is more likely to.
2. Draft program documentation
Write documentation for this program for a developer who has never seen it. Cover its purpose, inputs, outputs, files used, the business rules found in its conditions, and any risks you notice. Mark every assumption clearly.
Check: Read the business rules section closely. That's where a wrong guess does the most damage later.
3. Build test data
Here is a file layout: [layout]. Generate 20 test records. Include edge cases: blank and invalid dates, zero and negative quantities, maximum-length fields, and names with special characters. Explain what each edge case is testing.
Check: Use made-up data only. Confirm field lengths and decimal positions match the real layout before you load anything.
4. Find the right Db2 for i service
Which IBM i SQL service would show me [what you need]? Give the exact service name and an example query, and tell me which IBM i release it requires.
Check: Look the service up in IBM's documentation before you run anything. If you can't find it, it may not exist.
5. Explain an existing SQL statement
Explain what this SQL statement does in plain language, clause by clause. Point out anything that could perform poorly on a large file.
Check: Run it against a small test set and see whether the results match the explanation.
6. Convert fixed format to free format
Convert this fixed-format RPG to fully free-format RPG. Keep the logic identical. List every change you made and note anything that needs a manual check after conversion.
Check: Compile it, then run the old and new versions against the same test data and compare the results.
7. Trace a problem
Here is the symptom: [what the user sees]. Here is what should happen: [expected result]. List the possible causes in order of likelihood. Include causes outside the code, such as data, configuration, or differences between environments. For each one, tell me how to confirm it or rule it out.
Check: Don't stop at the first cause on the list. Two of our three examples above were not where the first theory pointed.
8. Plan the tests for a fix
I changed [describe the change] to fix [describe the problem]. Write a test plan: one test that proves the fix works, and regression tests for the nearby behavior that should not have changed. Give each test steps and an expected result.
Check: Add the cases only your business would know about. AI can't guess those.
How we check its work
We treat AI like that well-read new hire: helpful, eager, and not yet trusted with production. Our short version is "trust, but compile." The long version is six steps.
- Compile it. The compiler has no feelings and no interest in being polite, which makes it an excellent fact-checker.
- Confirm it against IBM's documentation. Any service, command, or API it names gets looked up.
- Test it with ugly data. Edge cases included, not only the happy path.
- Read it line by line. If a developer can't explain what a line does, it doesn't go in.
- Review it. Anything headed for production gets the same review as code written by hand.
- Look at what actually happened. Check the stored data and the real output, not only what the code says should happen.
A starter AI policy for your team
Your developers are probably using AI already. A short, clear policy beats a ban nobody follows. Here's a place to start.
- Decide what may be shared with an AI tool, and write it down. Follow your company's rules and your clients' rules.
- Keep customer data, credentials and anything sensitive out. Use made-up sample data instead.
- Verify everything AI produces before it's used. No exceptions for "it looked right."
- Keep the same code review process, whoever or whatever wrote the first draft.
- Share what works. A prompt that saves one developer an hour will save the whole team a day.
What this means for your team
For developers, AI is worth learning now. It won't do the job for you, but it makes the slow parts faster, as long as you stay in charge of the answer.
For managers, the question isn't whether to allow AI. It's whether your team has a safe, consistent way to use it.
Used well, AI doesn't replace experience. It helps newer developers get productive sooner, and it gives experienced developers time back for the work only they can do.
We can help
If your team wants help bringing AI into IBM i development the right way, or needs developers who already work this way, we can help. Reach us at customerservice@issiconsulting.com or through our contact page.
We'll keep adding prompts to this page as we find ones worth sharing, so check back.