Migration & Modernization

Unlocking new potential: Transform your Assembler programs to COBOL with AWS Mainframe Modernization

During the modernization of mainframe applications with AWS, migrating business functions implemented in Assembler can be part of the workload scope. AWS Mainframe Modernization Code Conversion with mLogica is an AWS cloud-native service to convert Assembler programs and macros to COBOL programs and copybooks. This blog post describes the conversion approach, its benefits, and provides an Assembler code conversion walkthrough.

Need for modernizing mainframe Assembler code

Many mainframes’ customers have Assembler programs in their software portfolio running core business functions. It impacts all industries, such as banking, insurance, retail, airlines, automotive, and telecommunications. A survey completed by mLogica estimates that 66% of enterprise mainframe applications have some Assembler code. The Assembler programming language consists of low-level machine instructions specific to a mainframe’s hardware architecture. Customers previously developed in Assembler for routines requiring high performance, particularly in mature applications.

However, Assembler is expensive to maintain and contributes to technical debt due to a lack of alignment with modern coding standards. Assembler skills are dwindling fast, and programs can be difficult to read, understand (due to limited code documentation), maintain, and upgrade. Additionally, many Assembler programs and macros interact directly with the operating system, adding to their complexity. Customers are looking for solutions to solve these challenges without the risks of manually rewriting the Assembler programs.

With strategic goals to modernize mainframe workloads to the cloud, customers want to decrease operating costs, avoid mainframe skills shortages, and boost innovation. When migrating a mainframe workload to AWS, the Assembler code presents a significant challenge due to its complexity and required skills. Manually rewriting Assembler programs does not scale, requires scarce specialized skills, and delays the overall migration timeline. Customers asked us to build a solution that can speed up modernization of a mainframe workload, incorporating Assembler programs and macros at lower cost.

Introducing AWS Mainframe Modernization Code Conversion with mLogica

Announced during AWS re:Invent 2023, AWS entered a partnership with mLogica to build AWS Mainframe Modernization Code Conversion for Assembler. Since July 2024, we are excited to announce the public availability of the Mainframe Modernization Code Conversion with mLogica. AWS Mainframe Modernization Code Conversion is an AWS cloud-native capability available to convert Assembler programs and macros to COBOL programs and copybooks. The solution relies on technology from mLogica who have 20 years of global modernization project experience, including 100+ successful projects and 30+ Million Lines of Code (LoC) modernized.

AWS Mainframe Modernization Code Conversion provides a self-service capability to convert the Assembler language source code to COBOL for various environments. The solution can target different COBOL compilers, such as the IBM Enterprise COBOL compiler, Micro Focus COBOL compiler, or NTT DATA Enterprise COBOL (UniKix) compiler.

Depending on the target compiler, COBOL programs and copybooks generated by AWS Mainframe Modernization Code Conversion can run in various COBOL runtimes, including the mainframe. The converted COBOL programs can be integrated into existing modernization projects, for example:

  1. Automated Refactoring projects: Automate transformation from COBOL language applications into agile Java-based services minimizing the technical debt on numerous dimensions for strategic transformation. Customers can use AWS Mainframe Modernization Refactor with AWS Blu Age
  2. Replatforming projects: Migrate COBOL and PL/I applications preserving the programming language while modernizing infrastructure and processes for agility with cloud DevOps native operations. Customer can use AWS Mainframe Modernization Replatform with Micro Focus or AWS Mainframe Modernization Replatform with NTT Data.

Benefits

AWS Mainframe Modernization Code Conversion solution unlocks the migration of Assembler to COBOL, helping organizations deliver large modernization initiatives while addressing the Assembler skills shortage. It helps unleash innovation and pursue strategic goals to modernize mainframe workloads in the AWS Cloud.

AWS Mainframe Modernization Code Conversion solution accelerates the code analysis and conversion from Assembler to COBOL using a unique tool-based approach. The self-service approach increases productivity by analyzing and automatically converting the Assembler code to COBOL. It provides opportunities to decrease technical debt by migrating Assembler to COBOL. The converted COBOL source code enables better integration with other applications, on and off the mainframe. It provides increased modernization options to move mainframe workloads that incorporate Assembler to the AWS Cloud.

Figure 1- Overview of AWS Mainframe Modernization Code Conversion

Figure 1- Overview of AWS Mainframe Modernization Code Conversion

AWS Mainframe Modernization Code Conversion service is available via a container image hosted in Amazon Elastic Container Registry (Amazon ECR) and executed with AWS CodeBuild for lifecycle management of the underlying compute. Users benefit from an AWS managed solution for analyzing and converting Assembler programs and macros into COBOL. The service runs within your AWS account and does not transmit or store Assembler or COBOL source code outside your AWS account.

AWS Mainframe Modernization Code Conversion is compatible with Infrastructure as Code tools following deployment best practices for security and data protection. It leverages AWS CloudFormation, AWS Cloud Development Kit, and Terraform to deploy an Amazon S3 Bucket and four CodeBuild projects into your AWS Account.

Assembler conversion in action

A specialized modernization methodology is implemented to provide an efficient journey defined by four pre-configured steps implemented as CodeBuild projects.

Self-register for the AWS Mainframe Modernization Code Conversion service

First, you must self-register an AWS Account to use the AWS Mainframe Modernization Code Conversion service.

Open the AWS Management Console and select the AWS Mainframe Modernization service. From the Tools menu, click on Share assets with my AWS Account. This will authorize your AWS Account to use AWS Mainframe Modernization Code Conversion with mLogica service.

Figure 2- Self-registering process for AWS Mainframe Modernization Code Conversion service

Figure 2- Self-registering process for AWS Mainframe Modernization Code Conversion service

Deploy the solution

To prepare the transformation environment, click the Launch Stack button to launch an AWS CloudFormation stack in your AWS Account. To deploy this solution into your preferred AWS Regions, download the solution’s CloudFormation template, and deploy it to your AWS Region.

Review the stack name and the parameters for the template. The default value is AWSM2CodeConversion.

  1. On the Quick create stack screen, scroll to the bottom, and select, I acknowledge that AWS CloudFormation might create IAM resources.
  2. Click Create stack. The deployment of the AWS CloudFormation stack will take 1–2 minutes.
Figure 3- Stack created in AWS CloudFormation

Figure 3- Stack created in AWS CloudFormation

Once the stack is created, access the CodeBuild service to start the Assembler modernization journey using the four Build projects provided by AWS Mainframe Modernization Code Conversion:

  1. define_project: Create the project structure in an S3 bucket and upload the Assembler component.
  2. analysis: Analyze Assembler and macros programs providing reports.
  3. expand_macros: Optionally expand macros in Assembler programs.
  4. convert: Convert assembler programs and macros to COBOL programs and copybooks.
Figure 4- Overview of the four steps representing the journey for code conversion in the CodeBuild service

Figure 4- Overview of the four steps representing the journey for code conversion in the CodeBuild service

Step 1: Create the project in the Amazon S3 bucket

From the CodeBuild service, select and start the first step named define_project to create the project structure in an S3 Bucket.

Figure 5- Overview of the first step in the CodeBuild ready to be started.

Figure 5- Overview of the first step in the CodeBuild ready to be started.

The CodeBuild project automatically pulls and runs the container image to create the conversion project.

Figure 6- Overview of the CodeBuild project details.

Figure 6- Overview of the CodeBuild project details.

Once the build is successful, go to the S3 bucket and upload Assembler programs and macros to the newly created project folder titled prj_codebuild_01/.

Figure 7- Overview of the generated output project folders in S3 Bucket.

Figure 7- Overview of the generated output project folders in S3 Bucket.

Step 2: Run the Analysis and Generate reports

From the CodeBuild service, select and start the analysis step to analyze the Assembler inventory uploaded in the S3 Bucket. There are no AWS charges for the language transformation from Assembler to COBOL using AWS Mainframe Modernization Code Conversion with mLogica – define_project.

Figure 8- Overview of the second step in the CodeBuild ready to be started.

Figure 8- Overview of the second step in the CodeBuild ready to be started.

The CodeBuild project automatically pulls and runs the container image to process the analysis and generate reports, which are loaded to the project in S3 bucket. Once the analysis is complete, go to the S3 bucket and download the reports.

Figure 9 - Overview of the generated output (analysis reports) in S3 Bucket.

Figure 9 – Overview of the generated output (analysis reports) in S3 Bucket.

The following reports are generated:

  1. AWSM2CCM-Analysis-Report-*.pdf: This report is an important aspect of the AWS Mainframe Modernization Code Conversion, the Code Analysis report. This is generated to estimate the complexity of your Assembler Code Conversion. The executive report summarizes information about the Assembler Code Billing and Scope, Conversion Summary, Detailed Conversion Statistics and Improving the Conversion. This report is available in PDF format.

    Figure 10 - Example of the generated analysis report (AWSM2CCM-Analysis-Report-*.pdf)

    Figure 10 – Example of the generated analysis report (AWSM2CCM-Analysis-Report-*.pdf)

  2. Conversion_Detailed_Statistics.txt: This provides the frequency and expected conversion result, shown as “Conversion Status” for each Assembler instruction found in each component. It provides a quick way to identify whether instructions are in use that the converter does not support.
  3. Conversion_Global_Statistics.txt: This technical report provides a summary of the “Conversion Status” at a component level.
  4. CrossReference_Global_Statistics.txt: This technical report provides Assembler program dependencies on Macros. It provides a quick way to determine if any macros are missing from the uploaded code.
  5. CrossReference_PgmToPgm.txt: This technical report provides Assembler program dependencies to other programs. It provides a quick way to determine if any Assembler programs are missing from the uploaded code.

It is critical to review these reports before running the actual conversion during the convert step.

Step 3: Run the Assembler macros expansion

Mainframe Assembler code frequently uses macros to encapsulate functionality for reuse (similar to function in modern programming language). Macros behavior is typically determined at application runtime based on parameters passed from an Assembler program. Some Assembler instructions classified as Conditional Assembly Language instructions (such as branching AIF, AGO instructions) influence the macros behavior and execution. The technical challenge for the code conversion to COBOL is the dynamic flow of Assembler macros depending on Conditional Assembly Language instructions.

During the analysis step, Conditional Assembly Language instructions are discovered in the Conversion_Detailed_Statistics.txt report. If found, these instructions are candidates for expanding (or re-engineering) the identified Assembler macros into Assembler programs. If not found, there is no need for expanding Assembler macros.

AWS Mainframe Modernization Code Conversion includes a mechanism for removing Conditional Assembly Language instructions facilitating code conversion to COBOL. The solution supplies features that can serve as a preliminary step before conversion to obtain a cleaner static Assembler code.

If Conditional Assembly Language instructions are found during the analysis step, upload identified Assembler source code and the related High-Level Assembler listing file to the S3 Bucket. The listing file is generated by the mainframe compiler. It includes the relevant macros to expand in the code, and additional information such as symbols dictionary, overriding parameters as examples.

Figure 11 - Overview of the project to expand Assembler macros in S3 bucket.

Figure 11 – Overview of the project to expand Assembler macros in S3 bucket.

From the CodeBuild service, select and start the third optional step named expand_macros to expand the macros in the Assembler programs inventory previously updated in the S3 Bucket. There are no AWS charges for the language transformation from assembler to COBOL using AWS Mainframe Modernization Code Conversion with mLogica – expand_macros step. Once started, the CodeBuild project automatically pulls and runs the container image to expand the macros into the Assembler programs. Once the build has succeeded, go to the S3 bucket to get the expanded Assembler programs.

The result is a modified version of the processed Assembler programs. The macros are no longer included as external modules and have been incorporated into the Assembler programs (identified by the listing file).

Step 4: Run the Assembler code conversion to COBOL

From the Amazon S3 Bucket, configure the project_settings.json.

Figure 12 - Overview of the project to edit project_settings.json in S3 bucket.

Figure 12 – Overview of the project to edit project_settings.json in S3 bucket.

The file specifies parameters such as target compiler, endianness, file extension for generated COBOL programs and copybooks, traces, and COBOL alignment in files.

{
"Source programs directory":"srclib",
"Source copybooks/macros directory":"macrolib",
"Copybook/Macros Conversion":"Called_only",
"Do not regenerate the Copy/Macro if already exists":"false",
"Target Compiler":"IBM",
"Endianess":"Big",
"Converted programs extension":"",
"Converted CICS programs extension":"",
"Converted copies/macros extension":"",
"Trace Level":"STANDARD",
"Trace file open mode":"append",
"Data definition level":5,
"Start picture column":40,
"Generate Sync FILLER with name":"FILL-SYNC",
"Use SYNC clause":"yes",
"Decimal Point Comma":"true",
"Original Source Placement":"RIGHT"
}

From CodeBuild service, select and start building the fourth and final step, named convert. This converts the Assembler programs and macros to COBOL programs and copybooks. AWS Mainframe Modernization Code Conversion with mLogica – convert step applies fees to the customer. Visit AWS Mainframe Modernization Pricing for details.

Figure 13 - Overview of the fourth step in the CodeBuild ready to be started.

Figure 13 – Overview of the fourth step in the CodeBuild ready to be started.

The CodeBuild project automatically pulls and runs the container image to convert the code from Assembler to COBOL. The results are stored in the same S3 bucket. Once the build has succeeded, go to the S3 bucket and download the generated COBOL programs, copybooks, and related COBOL dependencies.

Figure 14 - Overview of generated output (at folder level) for COBOL programs, copybooks, and dependencies.

Figure 14 – Overview of generated output (at folder level) for COBOL programs, copybooks, and dependencies.

Note: AWS Mainframe Modernization Code Conversion generates hash files to track code conversion runs, hosted in the project in the S3 Bucket. Updating the Assembler source code in programs and macros can impact code conversion and billing:

  1. source code is untouched: the solution will not apply fees for a new code conversion.
  2. source code is updated to remove lines of code: the solution will not apply fees for a new code conversion.
  3. source code is updated by adding lines of code: the solution will apply fees for the new lines of code.

Once the code conversion is complete, compile and test the COBOL components as part of your mainframe migration project. Compiling and testing are outside the scope of the AWS Mainframe Code Conversion solution.

Pricing

AWS Mainframe Modernization Code Conversion charges for the components in their entirety. It charges for every line of code in each in-scope component, including lines that could not be converted, were partially converted, and were totally converted. AWS Mainframe Modernization Code Conversion counts the lines of code in programs, referenced copybooks, and macros within its scope, and charges based on the total line count. Visit AWS Mainframe Modernization Pricing for details.

Copybooks and macros unreferenced by an Assembler program are considered out of scope. For example, assume a program has 1,000 lines of code. After processing, 700 lines are fully converted, 200 lines are partially converted, and 100 lines are not converted. The billable lines of code for this example would be 1,000 lines of code corresponding to the total number of lines of code processed.

Code conversion assistance

AWS Mainframe Modernization Code Conversion is released to provide you with opportunities to start decreasing your technical debt to achieve your business goals.

If you seek a higher conversion rate for the lines of code from Assembler to COBOL, contact your AWS representative for additional engagement options. This may require a calibration effort or professional services assistance.

Go modernize Assembler yourself

AWS Mainframe Modernization Code Conversion accelerates application modernization by converting Assembler programs and macros to COBOL. It reduces conversion effort and cost through a self-service solution. Once converted, organizations can run COBOL programs and copybooks on and off the mainframe. The results are compatible with AWS mainframe modernization journey tools, such as refactoring with AWS Blu Age and replatforming with Micro Focus and NTT Data. To get started, please visit AWS Mainframe Modernization Code Conversion with mLogica documentation.

About the Authors