Migration of RPG code to JAVA on IBM iSeries

Business-Transformation-Process
Spread the Word

IBM is encouraging businesses to move their RPG code to java/J2EE and therefore many companies working on legacy technologies such as IBM i are looking for ways to ease the transition. IBM is encouraging businesses to move their RPG code to java/J2EE and therefore many companies working on legacy technologies such as IBM i are looking for ways to ease the transition.

We extracted general challenges that are faced during the migration from one of the client’s projects and provided the solutions.

Why is RPG/400 to Java migration in demand?

There’s no doubt that RPG is a commendable language when it comes to IBM i development and security. Businesses are demanding migration to enhance user experience which is a key point in expanding the business.

Major reasons include:

  • RPG involves high cost of operations which are reduced in Java
  • RPG is a legacy language and therefore there is a lack of flexibility to meet business needs as per today’s business terms
  • Migrating to Java eases communication between the other Java and non-Java modules
  • RPG to Java migration streamlines the processes by bringing them on a single platform
  • As the iSeries-AS/400 continues down the legacy path, its technology debt is increasing and the ability to find skilled resources is decreasing
  • Highly skilled resources are available in market for Java with sustainable low cost

Here’s how Programmers.io enables to migrate safely from RPG to Java code. Let’s have a look at the challenges involved, solution and the impacts of the solution.

Challenges involved during RPG to Java Migration

As already discussed, Java and RPG are two different languages with very little in common. There’s no such word like ‘just migrate’ RPG to Java. The way of working and architecture of both the languages are completely dissimilar.

The tools available in the market are also inefficient when it comes to convert RPG into Java. Below are a few challenges involved during the code migration:

  • RPG code dependency
    The RPG code is completely dependent on the IBM i system. The code is hardwired to the AS400 system. The dependence of the current RPG programs on the I-Series operating system for data management is the main obstacle to migration. So, to proceed with the migration developers have to release the code from this proprietary dependency and reduce them to pure business logic.
  • Implementation of business logic and code optimization
    Implementation of business logic along with the code optimization is tedious as executing a query in RPG code now takes milliseconds. This is because the modern I-series programs now use embedded SQL to access a relational data base. The code optimization is needed to implement exact business logic in an efficient way in Java too and this is a major challenge.
  • Completely different codes
    In converting to Java, it is necessary to create a new access class for every file with embedded SQL statements. These classes must include the record structure as data attributes and the access operations as methods. Only the structure of these classes is generated, the access operation has to be rewritten. READs become SELECTs, WRITEs become INSERTs, REWRITES become UPDATEs and DELETEs remain DELETEs.
  • Converting the processing logic
    Another problem is that of converting the processing logic. As in RPG the code is generally not structured and is driven by GOTO statements. As a prerequisite to converting to Java the GOTO statements must be removed.
  • Hard wired data constants
    There are cases where the code also contains many hard-wired data constants that make it difficult to change the code. It also makes the code inflexible and non-reusable. By carrying over the hard-wired data into Java it would only make the Java code equally inflexible, non-reusable and difficult to relocate.

Solution to the challenges

Programmers.io has a team of IBM i professionals who have enabled many clients in achieving easy migration. Here are a few hacks that can be implemented to make this migration seamless.

RPG code

  • Re-engineering the RPG code
    The best solution to release the RPG code from i-Series dependency is to re-engineer the RPG code prior to migration. This helps in assessing the situation to develop modernization plans quickly.
  • Data Storage
    In many cases the RPG code uses work files to store temporary data. This is temporary data storage which involves data base connectivity multiple times. This can be removed from Java by storing data in lists, arrays or maps prior to processing.
  • Easy code optimization
    For code optimisation, the chain operation on several tables in RPG is replaced by executing the join query in Java to fetch the required data. This helps in optimizing the code efficiently and in no time.
  • Code reusability
    For code reusability and flexibility, constants are stored in an external configuration file so that any changes done in the config file do not affect the Java code. Hence, maintaining its flexibility and encouraging relocation.
  • Use of HashMap
    In some codes, the data is processed based on multiple key fields. So, to avoid the unnecessary iterations, using HashMap is the best possible way.

Business Impacts of successful RPG to Java migration

Migration process from legacy languages to new platforms is tough but ones done it leaves a positive impact on your business. Similar is with RPG to Java migration:

  • Businesses experience lesser complexities in management of code
  • It also helps you to do future enhancement in code easily as Java is a very versatile language and can be integrated with different platforms
  • Elimination of work files with java objects also enables businesses in minimizing data redundancy which has its own benefits

Conclusion

The migration of RPG code to Java also involves a lot many automated tools and methods but these tools do not give satisfactory results. Manual intervention of the RPG and Java technical experts is required. To get the best results the control logic has to be rewritten, the converted methods have to be checked and verified by experts. The process requires a dedicated team of IBM i and Java programmers who have an in-depth experience.

Looking for easy migration? Get in touch with our consultants to know more.


Spread the Word