Too many controversial, unsafe or deprecated keywords in procedure divisions

Too many controversial, unsafe or deprecated keywords in procedure divisions

Software ResiliencyCode Reliability
This code insights looks in COBOL procedure divisions for a list of possible deprecated or controversial keywords and verifies if their usage frequency is abnormaly high.

Possible deprecated or controversial keywords Highlight looks at: SELECT, ACCEPT (if not followed by FROM DAY, FROMTIME or FROM DATE), CORRESPONDING or CORR, NOTE, ENTRY, NEXT SENTENCE, DISPLAY … UPON CONSOLE, INITIALIZE, MERGE.

Why you should care

Over decades, COBOL systems have been proved to be robust and resilient. However, some instructions or keywords can still have negative and unexpected impacts on your applications, or are just known as deprecated since … 1974! Below are a few examples and possible consequences it may have when used too frequently;

Avoid the keyword input instruction ACCEPT because it can lead to a treatment interruption.

Avoid using CORRESPONDING clause because this requires some homonymous variable declarations that are more ambiguous to use for other instructions. While it was usefull when punching physical cards many decades ago, it could save a lot of time/typos.

Avoid using NOTE  because it introduces a comment for the whole paragraph if it is the first instruction, or until the next dot. The instruction is deprecated since COBOL 74.

Avoid using ENTRY because it introduces an alternative entry point in the program.

Avoid using NEXT SENTENCE statements because it transfers control to the next COBOL sentence – that is, following the next dot. It does not transfer control to the logically next COBOL verb as occurs with the CONTINUE verb.

CAST recommendations

Static code analysis tools can help your development teams identify this code insight, while peer code review is useful to educate junior teams on all the subtleties of an older language.

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

How it worksFeatures & Analytics