Cobol to java modernization Automated

Why Modernization Is Hard? – Series 2

Conditional handling in COBOL is quite tricky to replicate in newer languages for a few reasons.

1. The character comparisons use EBCDIC codepage which has different collating sequence than ASCII/UTF-8. The non-equal comparison operators viz. >, >=, <, <= can result in different results when compared with EBCDIC collating sequence as against ASCII/UTF-8. e.g. String compare of literals viz.‘123ABC’ > ‘ABC123’ on mainframe will be flagged as True while it will be exact opposite in ASCII/UTF-8.

2. Comparing two different variables (PIC X(nn)) of different sizes are padded with SPACES (hexadecimal 40) and then compared. This can cause a difference in results if not handled correctly. Business rules depend on this kind of conditional handling.

77 WS-LONG-CHAR PIC X(10).

77 WS-SHORT-CHAR PIC X(7).

IF WS-LONG-CHAR IS EQUAL WS-SHORT-CHAR

The above condition requires that WS-SHORT-CHAR to be padded with three EBCDIC space characters.

3. A variable with DISPLAY Numeric can behave either as a number or as a character field and this causes extra complex conditional handling. Especially if one side of the condition is DISPLAY Numeric and other side is a Character or a Literal.

The following example will not work if WS-NUM PIC 9(2) has value 9.

IF WS-NUM IS EQUAL ‘9’ or equivalent character variable – PIC X(nn)

4. I have also seen many Multi level Nested IF / ELSE scope abruptly ends with a period or dot in COBOL. This could cause LLM to completely misunderstand the business rule.

Example below abruptly ends all levels of nested IF/ELSE with a period.

5. I have also seen some strange behavior from AI such as (real business cases):

IF WS-STR( I, J, K)( A -B – C : D -E) = FUNCTION LOWER-CASE ( WS-X-VAL ( A -B -C: D -E) THEN

Confuses the LLM as below

IF WS-X-VAL = ‘AB””CD”EF”’ THEN  changed the actual literal to hide the real business case

Confuses the LLM as below

Summary

What I have highlighted above represents just a small subset of the real issues encountered during legacy modernization. Understanding the actual business intent behind COBOL conditional logic can be a lengthy process unless you have a robust toolset like CloudFrame.


Venkat Pillay
Venkat Pillay
Founder and CEO

Venkat is a true technology visionary, serial entrepreneur, strategist, deep generalist, and architect. With over 25 years of experience and a passion for innovation, his expertise ranges from Legacy to emerging technology and company building.

Related Posts

why-modernization-projects-fail-and-how-to-make-it-a-success-series-10

Why Modernization Projects Fail And How To Make It A Success – Series 10

When legacy modernization efforts turn into a battlefield between IT ambitions and business realities, the outcome is almost always the same: reality wins. Unfortunately, by the time reality prevails, ...

Read More Aug 27, 2024
why-modernization-is-hard-series-9

Why Modernization Is Hard – Series 9

Modernization should directly support your company's strategic goals. Whether it's entering new markets, improving customer experience, or enabling faster product development, the decision to moderniz ...

Read More Aug 21, 2024
why-modernization-is-hard-series-8

Why Modernization Is Hard – Series 8

COBOL programs often generate reports where field formatting is handled using the 'PICTURE' clause. This clause allows for complex numeric editing and formatting options in these legacy programs. Most ...

Read More Aug 14, 2024
modernization-challenges-db2-syntaxes

Modernization Challenges – Db2 Syntaxes

A common occurrence in COBOL/DB2 programs is the coding of SQL SET assignment statement. This could be used for assigning Current Timestamp, Current Date/Time and doing various Date/Time arithmetic wi ...

Read More Aug 06, 2024