Your order system runs its nightly jobs in RPG today, and the business expects those jobs to finish every night. Two groups in your shop want different roads for that code. One group wants to refactor it into free-format RPG and keep it on IBM i, and the other wants to rewrite it in a new language. Both roads are good work. The refactor vs rewrite argument still stalls, because each side argues from memory and nobody has mapped the source library yet.
Once we map the source, you can see what each program does and what depends on it. Then the choice gets smaller, because you make it for each program on its own.
What refactor and rewrite mean for RPG
What is the difference between refactor and rewrite? On IBM i, a refactor keeps a program in RPG, and we convert its fixed-format source into free-format code. On that road the platform, the database, the jobs and the business behavior stay where they are. The change stays inside the source code.
A rewrite moves the program’s logic out of RPG and into a new language, such as Python. We convert that logic as mechanical work. Job scheduling, data queues, spool file handling and CL programs need more than that, because they have no one-to-one Python equivalents. On a rewrite, your team makes an architecture choice for each of them. A program that drives display files also ties its business logic to display file mechanics.
Free-format RPG came to the platform in two steps. OS/400 V5R1 in 2001 let developers write calculations in free format. IBM i 7.1 TR7 followed in November 2013 and let them write a whole program in free form.
Your own source library may mix styles for a separate reason. The mix depends on when your shop started and how it grew. A library often contains fixed-format RPG III beside free-format RPG IV, with DDS-defined files, display files, printer files and copy members threaded through it. AS/Forward takes in all six RPG dialects through our proprietary ingestion layer. We then put every member in the library on one map, whatever its dialect.
To see what the free-format road changes in your source, start with our guide to fixed-format to free-format RPG. Our page on converting RPG to Python covers the parts of a rewrite we convert as mechanical work and the parts that need a person.
Why refactor vs rewrite on IBM i is a choice per program
The question your shop asks is “Should we refactor or rewrite our RPG?” Advice on refactor vs rewrite usually treats that question as one decision for a whole application. On IBM i you can answer it one program at a time, and the answer starts with areas. An area is the part of the business that a group of programs serves, such as order entry or month-end billing.
We use one rule for the road: the goal your business sets for the area a program serves sets that program’s road. When the business wants order entry to stay on IBM i, the order entry programs take the free-format road. When it wants month-end billing in a new language, the billing programs take the rewrite road. That rule lets both groups in your shop be right about their own areas.
What sets the order on that road? Each program page in AS/Forward pairs the source with its plain-English description, its dependency edges, warnings for anything unresolved and a readiness status. The readiness status sets the order. A clean program is marked ready and can start first, and a program with gaps goes to human review before we convert it. A gap might be a missing copy member or a dependency the source never declares cleanly.
Can one system take both roads? It can, because each program gets its own road. One system can then reach more than one of these outcomes:
“Some shops want to move off RPG entirely. Others want to stay on IBM i and clean up fixed-format code into free-format. Plenty of buyers want to keep their green-screen workflows exactly as they are while modernizing what sits behind them. All of those are valid outcomes.”
You can also take the roads in stages. If the business later moves some of its parts to a new language, the programs we have converted to clean free-format RPG give you a better starting point.
Signals that point each program to a road
What sets the road for one program? The goal for its area sets it. Each signal comes from your own system or from your own people.
| Signal you can check | Where you check it | What it points to |
|---|---|---|
| The business wants the area to stay on IBM i | The people who run that area | The free-format road for every program in that area. Keep the screens, and modernize the code behind them |
| The business wants the area to move off RPG | The people who run that area | The rewrite road, in a new language, for every program in that area |
| The program drives display files, and its area is moving off RPG | The dependency edges on the program page | The rewrite road, where a person decides what the screen workflow becomes and we convert the business logic |
| The program is marked ready | The readiness status on the program page | An early start on its area’s road |
| The program shows a warning | The warnings on the program page | Human review first, then its area’s road |
| Nothing calls the program | The dead code list, checked against the job schedule | Out of the plan, whatever its area’s goal |
| A field change you plan touches the program | The migration view | The same piece of work as every other program on that list, with a person checking each one |
Your team can run four checks before anyone argues for a road:
- Ask the people who run each area to state the goal for that area in one sentence.
- Open each program page and write down its readiness status and any warning it shows.
- Give your operators the dead code list, and have them check it against the job schedule.
- Open the migration view for the next field change you plan, and list every program it touches.
Bring those four answers to the assessment, and the plan by program starts from facts your own people confirmed.
What happens to programs nothing calls
AS/Forward flags code that nothing references, and you get the dead code list as part of the analysis. That list comes from the same analysis that maps every dependency. A scheduled job can still start a program that no other program calls. Your operators therefore check the list against the job schedule first. Any program the schedule still starts stays in the plan and takes its area’s road like any other program.
Once the check is done, a program that nothing calls leaves the plan. It needs no road, and no piece of work includes it. Your approvers then sign a shorter plan, and every line left on it serves an area of the business. Each program off the plan is also one fewer program for the two groups in your shop to argue about.
How the migration view shows what a change will touch
Before any AI model touches the source, we use AS/Forward to map every dependency and trace call chains. We have one US patent pending on the way AS/Forward builds that structured context. From that work we build interconnection graphs across the whole codebase. You can pick a file and see what else a change to it affects. That answers the first question on any change: if we touch this, what else moves?
The migration view scopes the impact of changing one field or one object, and it lists what else changes. Every program on that list goes into the same piece of work. A person checks each one before the change goes in. That person starts from the program page, because it shows the dependency edges and any warning for that program.
The plain risk in any change is a job that breaks because nobody mapped the program behind it. Pick one field length your team has talked about changing, and use it as a test. On the map, that change turns into a list of named programs and print jobs. Before you plan the first piece of work, see how AS/Forward runs inside your own network. Then ask us to build the dependency map for your source library and run that test on your own field.
What a plan by program looks like
A plan by program gives each program its own line. That line takes its road from the area the program serves. Each line shows the area, the road that area’s goal sets, the program’s readiness status and the piece of work the program belongs to. With that plan in hand, the refactor vs rewrite choice turns into a list your approvers can check line by line. The people who run each area can also see every program on their area’s road.
AS/Forward offers incremental, program-by-program modernization that analysis guides and human review validates. Within each road, you order the lines by readiness status, and ready programs start first. A program with a warning goes to human review before its turn comes. A choice per program lets each program start as soon as its own source is ready. A program that nothing calls leaves the plan after the job schedule check, and it gets no line.
Your approvers compare the road on each line with the goal for the program’s area. When the goal for an area changes, the roads on that area’s lines change with it. For each piece of work, they also confirm two facts. Every program on the migration view list is in that piece of work, and a person checked each one.
The assessment comes first and sizes the work
AS/Forward cannot know the goal your business sets for each area. That goal comes from your people and your plans. It also cannot tell whether your job schedule still starts a program on the dead code list. Your operators settle that question.
We start with the assessment, because it sizes the work. We run AS/Forward against your source library. You get a program page for every program and the dependency map that links them. The migration-impact reporting then scopes what it would take to modernize, program by program, before you commit to anything. Our page on the IBM i modernization assessment shows what the assessment covers and what you get back from it. With the assessment in hand, you make the refactor vs rewrite choice for each area from your own source.
We do the work on both roads, and the road for each area stays your call. We refactor RPG to free-format on IBM i, and we rewrite it in the language you pick. AS/Forward runs air-gapped inside your own infrastructure. You choose the model, and with a local model no data travels to external APIs. AS/Forward works with Claude, OpenAI, Gemini or local models.
The tool does not force a rewrite you did not ask for. We keep the decisions in this order: “The assessment comes first, the target decision comes second, and the second decision is yours.”
Call us to sort your programs
Call 501-232-7188 and tell us which areas of the business your RPG programs serve. Tell us the goal your business sets for each area too, because each program takes its road from that goal. We build AS/Forward in Hot Springs Village, Arkansas, and we run each assessment ourselves. Say which group in your shop favors which road, and we will show both groups the same map. You can also send the same details through our contact page, and we will set up the assessment with you.