cloudframe | Resource
mainframe migration legacy code patterns COBOL program structure automated modernization code transformation

Why Modernization Is Hard – Series 8

Examine the hidden complexities of COBOL program structure that make automated modernization significantly harder than traditional code migration approaches. CloudFrame engineers break down real-world examples of legacy...

By Venkat Pillay Aug 14, 2024 ARTICLES

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 modernization efforts underestimate these complexities. We will highlight a few examples that we come across in customer programs.

The following table shows the results from running COBOL programs, where we recorded the output of various 'PICTURE' clauses with examples to illustrate the complexities of editing and formatting.

image-1726563631-1727416133

The currency symbol by default is $ and can be overridden by using COBOL Compiler option 'CURRENCY' or coding 'SPECIAL-NAMES' in the 'CONFIGURATION SECTION' of the COBOL program. An example of overriding currency to be printed as £ is by coding as follows:

image-1726563622-1727416153

This adds complexity to the formatting by printing £ where $ is used in the 'PICTURE' clause. The following table gives examples of output with the above CURRENCY SIGN definition.

image-1726563613-1727416189

We have seen more complexities with COBOL programs that generate reports with multiple currencies. In such scenarios 'SPECIAL-NAMES' are defined for multiple currencies and a customized 'PICTURE' clause symbol is defined. An example of such a definition is shown below.

image-1726563602-1727416241

The following table gives examples of output with COBOL variables defined using the above defined currency signs.

image-1726563585-1727416263

The above complexities are further compounded by the usage of 'SPECIAL-NAMES' definition of 'DECIMAL-POINT IS COMMA'. Many Central European countries switch the usage of Decimal Point and Comma in their amount fields. In these countries decimal separator is 'comma' and thousands separator is 'period'.

There are other formatting aspects where COBOL variables can be defined with clauses viz. 'BLANK WHEN ZERO' to suppress printing number 0 when the value of variable is zero, 'JUSTIFIED RIGHT' to right-justify a string in a 'PICTURE' Clause when default is to 'left-justify' strings, 'SIGN IS LEADING | TRAILING' to influence whether 'Sign overpunch' is on leading or trailing digit when default is 'trailing'.

Conclusion

Modernization projects often underestimate the complexities of these definitions and formatting aspects used by COBOL legacy programs, leading to delays and failures in achieving functional equivalence. CloudFrame's modernization toolkit, combined with AI, has extensive coverage to manage these formatting complexities to provide a seamless migration and transparent execution that guarantees functional equivalence.

Share Article

Spread this insight across your network.

X LinkedIn Facebook
Author

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.

Continue Reading

Related Posts

Ready to modernize?

Start your journey from legacy mainframe to modern cloud-native applications today.

Agentic AI

Agentic AI is CloudFrame's orchestrated intelligence layer that combines deterministic, probabilistic, and generative models to assist, guide, and learn across the entire modernization journey—from discovery to transformation and optimization. It is context aware, adaptive and capable of independent operation.