comp-5 redefination

Release: Net Express 5.1 .NET & Visual Studio 2012

While compiling the source from NE5.1 in Visual COBOL 2.2.1, we are receiving a warning for comp-5 redefinition.

The vaiables are defined as follows: 

               01  WS-MENU-ID      PIC S9(4) COMP-5.


                                       PIC S9(4) COMP-5.


                                       PIC S9(4) COMP-5.

This returns a warning about using this COMP-5 redefintion. Is there any way to remove these warnings? I do not want to suppress them. What are the implications it will have in code.

  • Verified Answer

    Hello anveksha,

    Net Express and Visual COBOL report the exact same warning, but the difference is that Net Express is not reporting warnings by default while Visual COBOL (IDE) is.

    The WARNING compiler directive is set to 1 by default in Net Express, and it is set to 2 in Visual COBOL (IDE).

    See more details from the documentation here


  • Verified Answer

    In your particular case, there are no implications because you have simply defined three-names for the same data item.  The documentation for error 1168 is:

              You have redefined a COMP-5 data item. Porting your code to other environments

                   might produce inconsistent results.

    Redefinition that doesn't define exactly the same COMP-5 data item could be non-portable between machines with different memory architecture, such as Intel versus IBM.  Thus, the warning; most of COBOL is portable between machine architectures.  COMP-5 is native machine byte order, which differs between machines.  The redefinition starts at the left-most byte, which might be the high-order byte (IBM) or the low-order byte (Intel).  This won't matter when the definitions are for the same data item description, as in your case.  However, REDEFINES allows for the case of the data items being described differently.  One could argue that the compiler should allow your case without a warning, but the compiler does not normally go to this level of analysis just to suppress a warning.