Navigating AS/400 RPG Program Modernization: Balancing Tradition and AI Automation
February 16, 2024
By Chris Isayan, Prolifics Associate VP, Digital Experience
Introduction
As I write this blog, I want to acknowledge the value of the AS/400 system and programs written in RPG. AS/400 RPG programs are still at the foundation of many businesses and there are still many mission-critical applications running in AS/400 RPG that have proven their reliability; some can’t even recall the last time they needed a restart. They are also highly secure—rarely you hear of an AS/400 being breached. These are just a couple of examples.
If these applications are so stable, secure, etc., then why modernize? The primary reason I hear from our clients is that the AS/400 RPG skill deficit and a shrinking talent pool. The secondary reasons, which are less emphasized, include the cost of making changes due to the monolithic nature of the application. Also, it is harder to use modern application development tools with RPG. We had another customer say, it takes too long to train new end-users on the 5250 “green screens,” and it lacks the capabilities today’s users expect. In short, while we recommend modernizing, the motivations and decision when to modernize ultimately rests with each organization, depending on their unique situation.
Concerns
Most clients who decided to modernize have reservations. The primary concern we hear from our clients is the years of complex rules and workflows embedded in RPG programs, coupled with a lack of clear separation between screen code and code behind. Clients think there is a good chance of losing essential logic during modernization. Additionally, the AS/400 database model is hierarchical in nature, organized in a tree-like structure, which makes it harder to understand for traditional RDMS experts.
Therefore, as you modernize the front-end, a deep understanding of the hierarchical model becomes crucial. Plus, transitioning to a relational database model, managing data migration, refactoring all dependent reporting and backend processes pose additional challenges. However, for now, let’s stay focused on the front-end.
Modernization Approach
Generally, we start with a workshop, assessment, and discovery phase. The fact is that a lot of applications on AS/400 are customized around the operations of a particular business with a “bunch of one-off” odd scenarios unique to each business. This can complicate matters when trying to plug something off-the-shelf.
So, as a guide, we identify client’s pain points, business nuances and operational flows, business capabilities clients have, or new capabilities they’ll need. We then rationalize their systems to understand what stays, what gets re-written and what gets off-the-shelf replacement. We might recommend that AS/400 hardware stay and host the applications that are written in the new programming language. For now, fast-forward and assume we have a prioritized list, budget, etc. to start the development cycle where we are writing BRDs, reverse engineering code to functional requirements, coding, functional testing, and handing over user acceptance testing. Is all of this done manually? What tools are available to help with automation? The good news is that there are reputable companies stating that they have tools that convert AS/400 frontend code. However, the bad news is that they won’t license the tools, i.e., they are for “internal use” only.
Recently, we’ve been exploring the development of our own tools using GenAI. Despite the complexity of AS/400 app modernization, we were able to utilize GenAI to deconstruct the process into three key steps: understanding the code, reverse engineering the business capabilities, and code translation to modern language. This streamlined approach accelerated the process and improved the quality of the outcome.
So, let’s look at what Gen AI can do. Our objective is in multiple folds, (1) ability to point to entire code, (2) extract business rules and request to generate code explanation for overall or specific business capability (3) ability to translate the code for specific business capability to another language. In a more practical sense, (1) point to supply chain ERP code, (2) request to describe the procurement code and (3) generate code for “New Purchase Order” screen; Angular for front-end and node.js for middle tier without impacting the database. Assuming you have two-week sprints, you start the app dev cycle. This model best fits when the application architect already created the scaffold code that includes essential structures, architectural decisions, design patterns and best practices. This involves breaking down the application in multiple app.modules, implementing router guards, state management, logging, authentication and authorization, off-line capabilities, etc. Once the foundation structure is established, the Gen AI generated code can be integrated into the scaffold.
Note: you can feed the scaffold code Gen AI to fine-tune the model and regenerate the “New Purchase Order” screen. This approach achieves a balance between manual control over the architecture and the automated generation of specific code components. We can also specify the use of common libraries, such as Angular Material and code that will be generated using Angular Materials.
One issue we found was when using a large language model like ChatGPT, which has a cutoff date for its training data, there’s a risk that the code it provides may be outdated and may include deprecated methods and libraries, especially in fast-evolving programming frameworks like Angular, React, and others. So, we overcame this issue by provisioning our own LLM on the cloud and, through prompt engineering and fine-tuning, were able to bring the model to our liking. Also, you may need to alternate between models (such as code-daVinci, text-daVinci, and GPT) depending on whether you are generating code explanation or code translation. Additionally, we engineered the model to adhere to best practices, design patterns, and specific architectures to produce the expected code. But even with all the prompt-engineering and fine-tuning, it’s essential to manually review the code, run automated unit tests, and assert potential issues, and finally, fine-tune the model further.
Another issue we encountered was the inconsistency of the generated code. In other words, each time you request to generate code, you’ll receive a slightly different translation of the same RPG code. While you can adjust parameters like temperature, provide templates to achieve consistent behavior, it is essential that the code is manually reviewed. We are still working on implementing a set of rules and templates to ensure more consistency in generated code. In summary, while we strongly recommend using Gen AI for code explanation, achieving accurate and consistent code translation requires more prompt-engineering and templating.
It is noteworthy to mention that IBM watsonx Code Assistant for Z solution uses both rules-based and Gen AI process for code translation. Additionally, it takes into account programs on the mainframe and maps out architectural flow diagrams for each, with all of their data inputs and outputs. Unfortunately, this only works on Mainframe Cobol code on Z.
Coexistence of Legacy and Modern Applications
As you migrate from AS/400 RPGLE and DDS code to a more modern code, the entire ERP modernization process may occur in phases, taking months and years. For instance, you might release the procurement part of the application first, followed by inventory and warehouse management, transportation, etc. As you roll out different parts of the legacy ERP system, both legacy and modern applications will coexist. It’s crucial to have a solid rollout plan, legacy decommission plan, etc. Additionally, keep in mind that while the applications are running side by side, you need to have a well-thought-out plan to minimize maintenance costs, such as optimizing or re-utilizing hardware and other resources for both systems. Lastly, ensure you have a plan in place to train staff who are accustomed to maintaining the legacy app so they can effectively maintain the modern app. These considerations need to be planned upfront and not treated as an afterthought.
Deployment & Change Management:
From the business user’s perspective, Deployment & Change Management plays a pivotal role in ensuring a seamless transition to modern applications. It’s important to note that many experienced end users love their “green screens.” In fact, some don’t even look at the screen; they predominantly use the keyboard (not the mouse) to navigate, a couple of tab presses, couple of function key presses and they are done. Therefore, it is critical not to compromise functionality during modernization and to have a good understanding of the system usage from an end-user perspective. Also, business capabilities need to be delivered in their entirety. For example, plan the deployment phases considering the specific workflows of business users to minimize users going back and forth between legacy and modern applications. If necessary, provide single sign-on capabilities to ensure seamless navigation for the end-users.
Effective change management is essential to address concerns, keep a log of these concerns, create “Run Books,” communicate changes transparently, and provide adequate training for a smooth adoption of the modern application. Utilize pilot users as your champions to foster a positive environment, enabling remaining users to efficiently leverage the advancements brought about by the modern app. Ideally, the goal is to experience zero disruptions to daily operations and become more efficient in what they do.
Conclusion
More and more companies are gradually transitioning their AS/400 RPG code to modern programming languages, and each company needs to decide when to transition. Our recommendation is transition while you have in-house RPG experts to provide an oversight and facilitate a smooth transitioning. We believe that your experienced internal RPG teams are essential for an effective transition and success of this modernization effort. The best solution is to partner with digital engineering companies, like Prolifics, that have an outstanding track record of delivering modern applications, as well as having a good, automated approach in reverse engineering applications.
Prolifics also provides prototypes, accelerators such as fine-tuned Gen AI models, which can reverse engineer the application, create data models and starter code. Additionally, Prolifics offers automation testing tools to accelerate the modernization journey with the highest quality. The Prolifics team will integrate with your existing teams and will work with you on a customized approach, as well as estimating cost and timelines for modernizing your application. With a teams integrated approach, your internal teams will understand the new application architecture, will be trained, and can easily take ownership at the project’s conclusion.
Special Thanks
I would like to express my sincere appreciation to Prolifics’ Konrad Konarski, Gregory Hodgkinson, Honda Bhyat, Rajeev Sharma, Ramnath Nalluri and Sheryl Oleksa for their valuable feedback and insights during the development of this blog. Their thoughtful input significantly enhanced the quality and depth of the content. Thank you for your valuable contributions.
Chris Isayan, Prolifics Associate VP, Digital Experience, has extensive experience in assessing, designing and delivering at a global level. Chris is known to “learn the industry first,” then works with the line of business to infuse technology into every stage of business processes, empowering every organization, business unit and individual to do more with less. Presently, Chris is focused on utilizing Cloud and AI/ML to accelerate digital transformation. Chris prototypes his designs so they are not just ideas, whether it is using Cloud services, out-of-box computer vision and/or natural language processing (NLP) or creating his own models.