Someone in finance asks your analyst a fair question: how does the system price a late order? The analyst opens the order entry program and finds part of the answer in its calculations. Several other programs contain the rest, and the compiler pulls one shared copy member into each of them. Nobody ever wrote the whole rule down in one place. The analyst has to rebuild it from the source, one program at a time.
With business rule extraction, your team turns that hunt into a written answer. You find the rules your RPG code applies, and you write each one down in words a person in finance can check. Start with the late order rule, because someone in finance is already waiting on it.
What business rule extraction means
In business rule extraction, a team pulls the business logic out of a legacy or packaged application and restates that logic as rules. You can write each rule in natural language for people, or in a formal language that software can process. Your team then stores the rules in one place, where analysts can study them or use them to build the next system. Some teams call the same work business rule mining.
Teams often do this work inside an application modernization project or during a move to packaged software. It also helps a team that plans no move at all, because a written rule stays useful after the person who coded it changes jobs.
In an RPG shop, your team starts business rule extraction with a practical question. Where in the library does the logic live?
Where business rules live in an RPG library
Your source library often has fixed-format RPG III beside free-format RPG IV. DDS-defined files, display files, printer files and copy members thread through both kinds of program. Any one of these places can contain part of a rule, and a full answer to the late order question can touch several of them.
| Where to look | What you find there |
|---|---|
| Calculations in fixed-format RPG III | The conditions and the arithmetic that older programs apply to each record |
| Calculations in free-format RPG IV | The same kind of logic in newer syntax |
| Copy members | Shared source that the compiler pulls into each program at compile time, so one rule can live in one member and reach many programs |
| DDS-defined files | Field definitions, with the length and type that limit each value a program can store |
| Display files | The screens an operator uses and the fields a person keys in |
| Printer files | The layout of each printed report and the fields it prints |
Start with the calculations, because they show the logic most directly. Copy members need a second look, because one edit to a shared member reaches every program that includes it at that program’s next compile. Our post on how copy members hide dependencies explains why a shared member is easy to miss in a program by program review.
File definitions matter as well. A rule about a field depends on the length and type that the DDS sets for that field. Record the file next to every rule that uses one of its fields.
Before any extraction starts, you can check four things in your own library.
- Count the fixed-format and the free-format source members in your production libraries.
- List the copy members that your pricing and order programs include.
- Search your source for calls that build a program name from a parameter, because those calls appear in no static cross-reference.
- Write down the person on staff who can confirm each rule, next to the programs that person knows.
Two ways to pull rules out of the source
Can software pull the rules out for you? Software can do part of the job, and the two approaches to this work show which part.
A manual approach starts with people. Analysts interview the experts who know the system, and then they study the source to check what they heard. The analysts write each rule by hand from those notes.
The manual approach depends on the experts being available, and it depends on the analyst finding every piece of a rule. The late order question shows the limit. One rule can span several programs and a copy member, and the analyst has to find each piece.
An automated approach uses software to find the logical connections inside an application. The software links each program to the files and the other programs it uses, and the analyst starts from that structure.
The two approaches work best together. Software finds the connections in the source, and the people who know the business confirm what each rule means.
A plain-English description of every program
AS/Forward is our tool for the automated half of this work, and it has one US patent pending. It reads all six RPG dialects through a proprietary ingestion layer, and the oldest fixed-format programs get the same treatment as the newest free-format ones. From the ingested source, AS/Forward writes a plain-English description of every program.
Each program page pairs the source with four things: the plain-English description, the program’s dependency edges, warnings for anything unresolved and a readiness status. Your analyst opens the page for the order entry program and sees what it does in plain sentences, right beside the code those sentences describe.
That description is the first draft of a rule list. A program does two kinds of work. Some of its steps move data, such as reading a record or printing a line on a report. Other steps make a business decision, such as a condition that changes how the system prices an order. The analyst takes each sentence about a business decision and rewrites it as a rule statement in your own terms.
A useful rule statement says when the rule applies and what the system does next. Beside each statement, the analyst records the program and the file that the rule comes from. AS/Forward writes the descriptions, and your analysts write the rule statements.
Find every piece of a rule on the dependency map
A description covers one program, and the late order rule spans several. AS/Forward builds interconnection graphs across the whole codebase, and you can change a file and see what else moves. When a rule depends on a shared file, the map shows every program tied to that file. The analyst then opens the page for each of those programs and checks it for its piece of the rule.
Ask the same question before any change: “If we touch this, what else moves?” The map gives you the answer as a list of programs, and the program pages say what each of those programs does.
The map also helps you set an order for the work. Start the rule list with the files that the most programs touch, because a rule tied to one of those files reaches the most programs. Your source stays inside your network for the whole extraction, because AS/Forward runs air-gapped inside your own infrastructure.
What a person still confirms
A plain-English description says what the code does. A person still confirms that the code does what the business wants, and that confirmation belongs to your team. A rule copied into a new system with no check can change how the business prices an order.
One kind of call stays out of sight for every tool that reads source. A program can build the name of the program it calls from a parameter at run time. That call appears in no static cross-reference, because no tool that reads source can see the value. When a rule passes through a call like that, a person who knows the job confirms where the call goes.
An unresolved copy member is a second gap. It is a member the reading tool could not find, and AS/Forward lists it as a warning on the program page. Your team then knows which source to track down before anyone trusts a rule from that program.
AS/Forward marks clean programs ready, and programs with gaps go to human review before anyone converts them. You can apply the same split to rule statements. A rule from a ready program moves forward, and a rule from a program in review waits for a person to confirm it.
Put each rule statement in front of the person who owns that part of the business, and ask whether the statement matches what they expect the system to do. When the answer is yes, the rule is ready for the next system. When the answer is no, the analyst goes back to the program page and the source to find the difference. Either the code or the expectation is wrong, and your team needs to know which one. Record who confirmed each statement beside it, and the next analyst can see which rules a person has already checked.
Where the extracted rules go next
The rule statements support more than one plan, and every outcome is valid.
A conversion is one road. AS/Forward converts to the language you pick, such as free-format RPG or Python. Your testers then have a written check for each converted program.
If you move to packaged software, the rule statements become the list your ERP team configures and tests against. Our post on the AS400 vs SAP decision covers how to weigh that move against keeping your own code.
You can also keep the system as it is today and use the rule statements as your own records. A new developer then learns what a program does before opening the source. The next time finance asks how the system prices a late order, your team hands over a written answer.
The choice of road belongs to you, and the rule statements do the same job on each one. Our part is to hand your analysts a plain-English description of every program to start from.
Start with an assessment of your library
We start business rule extraction on your system with an IBM i modernization assessment. The assessment comes first and sizes the work. We run AS/Forward on your library and hand back a plain-English description of every program. Your analysts then turn those pages into rule statements, and we support that work on whichever road you choose.
Call us at 501-232-7188. Tell us which rule your team needs written down first, such as the late order rule, and which libraries contain your production source. If you prefer to write, send the same two details to our team in Hot Springs Village, Arkansas, through our contact page.