AWS Cloud Operations Blog
AWS Mainframe Modernization – Refactor Legacy code base to Java using AWS Blu Insights
According to Reuters , there are 220 billion lines of code in customers’ production environments running Cobol and other legacy languages. Customers are looking to modernize their mainframe-based applications to take advantage of the AWS Cloud. These advantages help them to increase their agility, their capacity to innovate, and to benefit from the continual trends with AWS of improving cost/performance ratios. It also helps them to gain access to a growing pool of candidates with experience running and automating workloads with AWS.
AWS Blu Age uses automated refactoring patterns within the AWS Mainframe Modernization service. It can convert languages like COBOL, PL/1, NATURAL, RPG/400, and COBOL/400 into agile Java services and web frameworks. It relies on fully automated refactoring by preserving the investment in business functions. It does this while expediting the reliable transition to Java , new data stores, and web frameworks. AWS Blu Age Refactor automatically creates modern applications from legacy monolithic mainframe or midrange source code. Applications in COBOL, generated COBOL, PL/1, NATURAL, RPG/400, COBOL/400 and their respective underlying databases and data files DB2, DB2/400, VSAM, IMS, IDMS are transformed into modern distributed applications. These transformed applications may rely on Angular, Java/Spring, PostgreSQL, or other databases such as Amazon Aurora, Amazon RDS for PostgreSQL, Oracle database, IBM Db2.
AWS Blu Insights provides tools that support the full process of modernizing source code from legacy applications and their databases. Technical tools help with inventory analysis, code assessment, code transformation, and test case capture. In the next section, we will learn about the features of AWS Blu Insights with the use case of a common modernization project.
AWS Blu Insights through the lifecycle of a Modernization Project:
In this section, we will discuss how AWS Blu Age can help meet your needs for mainframe migration and modernization projects. You will learn how AWS Blu Insights helps you understand your application inventory, and visualize dependencies between components. It will also help you understand how it can automatically transform your code to Java.
Inventory Analysis
Application modernization starts with an inventory of all mainframe applications and their associated functions to determine candidates for refactoring . For customers who have legacy mainframe applications, manual inventory of applications and functions can take an extended amount of time. AWS Blu Insights can provide inventory analysis within a few minutes for a mainframe/midrange system. This inventory shows the volume of source code, the type of languages used, and the cyclomatic complexity of the source. Cyclomatic complexity measures the number of linearly-independent paths through a program module. Programs with lower cyclomatic complexity are less challenging to modify and test than those with higher cyclomatic complexity. Figure 1 presents a default dashboard for a mainframe source code inventory.
Figure 1: AWS Blu Insights Dashboard
Dependency Analysis
Once you have a completed inventory, the next step is to identify internal and external dependencies within the code base.
-
Identify internal dependencies and entry points:
- AWS Blu Insights provides dependency analysis for applications in COBOL, generated COBOL, PL/1, NATURAL, RPG/400, and COBOL/400 languages with advanced visualization (Graph/Table). Dependency analysis provides dependency lineage of components as children to parent or vice versa. This feature provides analysis such as entry points and dependencies including SQL and file nodes.
-
Identify external dependencies:
- Additionally, during this exercise you may uncover dependencies for which source code is not available. For example, third party applications that are required to be remediated in order to support refactored code.
-
Identify missing components:
- After validating all the internal and external dependencies, you can mark the rest of the unresolved dependencies as missing components. These missing components can be copybooks, DCLGENs, COBOL source, file definitions, among others. It is important to get the complete code base before we move to the next step of refactoring the code.
-
Identify dead code:
- AWS Blu Insights provides pre-defined queries that can be used to create a dependency analysis graph. When using this graph, you can identify isolated nodes, where nodes are not calling nor being called by other nodes.
-
Data analysis:
- The dependency analysis generates a CRUD (Create, Read, Update, Delete) report. This report can help you identify database usage within an application . This same dependency analysis also provides a usage report at the file level. This can help you identify how a particular datastore is interacting with an application. Figure 2 shows a dependency analysis graph for an application. It shows color-coded nodes based on the type of component, also the connection lines to represent dependencies across nodes.
Figure 2: AWS Blu Insights internal dependency
Automated Code Transformation
Once the application’s code base has been analyzed with the dependency analysis, you then begin the refactoring process. AWS Blu Insights conversion includes three steps:
-
Transform:
- This step will import, parse, and analyze your inputs (legacy language code base) to create intermediary files in JSON or domain-specific language (DSL).
-
Refactor:
- This step helps you automatically refactor (adapt/change) artifacts generated by the Transform action. This is performed by passing configuration parameters to optimize or override certain conditions based on application.
-
Generate:
- This step generates all Java/Spring Boot elements from your intermediary files from previous steps. Figure 3 highlights the easy-to-use interface for converting these artifacts. This step can run in multiple parallel processes to speed up the code generation. Figure 4 shows the generated sample code base, using Java Spring Boot.
Figure 3: AWS Blu Age refactoring process – step by step
Figure 4: Generated Java code base sample
Capturing and Managing Test Scenarios
Once you modernize the code base, testing is required to validate functional equivalence. This is done by comparing scenarios before and after the modernization. AWS Blu Insights provides a capture and replay feature to record your test cases. It can connect to mainframes or midrange environments via TN3270 or TN5250 terminals, and provides access to character-based hosts. User interactions are recorded with screen capture videos, and interactions recorded in JSON and Selenium files. Figure 5 and Figure 6 represent test capture and the test replay process.
Figure 5: Connect mainframe and midrange
To replay test scenarios on modernized applications, testers can use the video and JSON recording.
Figure 6: Replay test case with JSON
You can manage, track, and update testing workflow within AWS Blu Insights using the feature called “Test Scenarios” under the “Management” tab. Figure7 represents the process of adding test cases and later managing the status.
Figure 7: Test case management
Project Management
AWS Blu Insights tracks the status of your project throughout the lifecycle of a project. Applications are grouped together based on technical or business similarity to form a work package. There can be multiple work packages in a project and each of the work packages can have its own delivery timeline.Figure 8 represents how AWS Blu Insights creates a timeline for a sample project when you group multiple work packages. Use the status feature in the management tab in AWS Blu Insights to manage the workflow. Tasks progress from ‘Assigned,’ to ‘In Progress,’ to ‘Deployed,’ to ‘Tested,’ and ‘Delivered.’
Figure 8: Blu Insights timeline for a sample project
Version Management
During the mainframe modernization cycles, there can be a need for the original code base to be enhanced during the assessment or transformation phases. This will require you to pull the latest code base into AWS Blu Insights. The version manager feature can complete a drift comparison that helps you identify any added, deleted, or modified files. Figure 9 shows the statistics provided by version manager on the dashboard.
Figure 9: Version manager with code comparison
Shared Spaces
AWS Blu Insights provides shared spaces for securely sharing the code, documents, and files, for across your project. Upon accessing Shared Spaces, you will have access to a list of Shared Spaces created by you or in which you are invited. All new users who are invited to shared spaces should already have account in AWS BluInsights or they will be prompted to register first.
Figure 10: How to create a shared space
Boosters
Boosters help provide integration with common DevOps tools (for example, JIRA, Jenkins, and GitLab.) Boosters link your project artifacts (work packages, files, test scenarios) to your issue trackers (for example, Atlassian Jira) and CI/CD pipelines. AWS Blu Insights also provides a feature for you to create a custom booster through secure connections to your other tools.
Summary
In this blog post, we discussed how AWS Blu Age powers faster modernization with the automated refactoring pattern within AWS Mainframe Modernization service. AWS Blu Insights provides essential technical tools like code analysis, code transformation, and testing. Additionally, it provides project management tools to integrate with your existing software development lifecycle tools.
Resources
How to get started: learn more about the AWS Mainframe Modernization Automated Refactor and benefit from mainframe modernization experts who will guide you through AWS best practices.
Start exploring this solution within your AWS account by selecting AWS Mainframe Modernization from the AWS Management Console and choose ‘Refactor with Blu Age.’
Watch the re:Invent 2022 video on AWS Mainframe Modernization Auto Refactor pattern.
About the authors: