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.

COBOL Good Coding Examples

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.

Related Posts

Get new content delivered directly to your inbox.

Author: Srini

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