COBOL GT Spaces and NE Spaces

COBOL Good Coding
COBOL Good Coding

Good COBOL coding practice take you to next level in your career. In COBOL greater than spaces and not equal to spaces is one interesting point. Recently in our project there was a discussion, which is the best method to follow.

Let me take an example,

IF X NE SPACES and LOW-VALUES

THEN

do whatever…

END-IF

In the above example, used not equal to for both spaces and low-values. The way using negative condition is difficult to understand by programmers. Also, you are giving two conditions by using and -this is also not good practice of COBOL programming.

Revised example is:

IF X GT SPACES or X NE LOW-VALUES

THEN

do whatever…

END-IF

The above revised coding example does make sense, and easy to understand by other programmers. And, there is no confusion.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.