1. Introduction

The expansion rate reflects how many lines of output code are produced based on a certain set of input code. This document explores the expansion rate when transforming COBOL code to C# or Java, using Anubex’ CodeTurn. The information is presented based on a concrete use case of a recently transformed COBOL application that went into production for one of our customers.

To get meaningful numbers out of this exercise, some additional background on the transformation of COBOL needs to be provided, specifically around the concept of COBOL copybooks and how these can be transformed. From a maintenance point of view, copybooks should be transformed into separate C#/Java entities as much as possible. However, due to the specific technical characteristics of all the technologies involved, this is not always possible. For more details on the complexities of the usage of COBOL copybooks, please see our document titled Anubex - Safely transforming COBOL COPY statements with CodeTurn. As a result, the following two different categories of COBOL programs are identified:

  • COBOL programs that don’t need to expand any of the COBOL copybooks used.
  • COBOL programs that need to expand at least one COBOL copybook.

The programs that fall in the first category provide the best insight into the quality of CodeTurn’s transformation as far as code expansion rate is concerned, knowing CodeTurn has been optimized to avoid expansion as much as possible.

1.1. Overview

The concrete use case presented here is a customer with the following main characteristics:

  • Over 1.800 COBOL programs were transformed into Java.
  • These programs use approximately 850 unique COBOL copybooks.
  • On average, each COBOL program consists out of 941 lines of code (including comments), with the longest program consisting out of a massive 47476 lines of code.

CodeTurn was able to preserve the COBOL copybook usage as standalone code in almost 75% of the programs, requiring expansion in the programs in just over 25% of the usages.

In our analysis of the expansion rate we have defined the following 5 categories of code expansion:

  • The expansion is less than a factor 1.25[1]
  • The expansion is between a factor 1.25 and 1.5
  • The expansion is between a factor 1.25 and 1.5
  • The expansion is between a factor 1.75 and 2
  • The expansion is more than a factor 2

[1] Due to code formatting differences between COBOL and Java/C# it is also possible for some programs to achieve an expansion rate below 1, where the Java/C# program is actually shorter than its COBOL equivalent.

1.2. Programs without expanded copybooks

The expansion rate of those programs that could be transformed without the need to expand any of the copybooks have been analyzed in detail. This resulted in the below diagram, classifying each program that was transformed. The analysis shows that close to 80% of the programs have very favorable expansion rates (i.e. up to a rate of 1.5). For these programs the developer is expected to not be impacted during the day‑to-day development activities by the code expansion. Only in 1% of the programs the expansion rate will produce more than twice as many lines.

1.3. Programs with expanded copybooks

As expected, in this case the expansion rate between COBOL and Java suffers from the fact that the code in the COBOL programs needs to be expanded during the transformation. Despite this, the below diagram shows that even in this case in 40% of the programs the expansion still remains below a factor of 1.5 as such having hardly any impact on the maintenance experience.

The expansion rate can be further optimized by selective modifications to the COBOL programs prior to the transformation and/or by introducing custom transformation rules in CodeTurn applicable for the project only.

2. Conclusion

The usage of CodeTurn to transform a real customer COBOL application to Java/C# produces equivalent object-oriented code with generally a favorable expansion rate – as evidenced by the provided case details. In those few cases were the code is deemed to require further enhancement options are available in the form of custom CodeTurn transformation rules, and selective rewrite of code e.g. to avoid the need for copybook expansion.

Do note that aside from the presented code expansion rate, the development experience is positively influenced further by the following:

  • The fact that CodeTurn preserves the original application comments, in (or close to) the original COBOL location.
  • CodeTurn’s preservation of the original application names of programs, variables, sections, …
  • Powerful features of modern IDE to navigate source code, syntax highlighting, autocompletion, …

3. How about your transformation projects?

Are you currently working on a transformation project and running into some unexpected issues? Or would you just like to have a demo and see how CodeTurn can simplify your project tasks? Get in touch at migrations@anubex.com

 

Want to know more?

Anubex has the right solution for you! Don’t hesitate to contact us with your inquiries.

CONTACT US