Microsoft KB Archive/32159

COMP Is Non-ANSI; Moving COMP to NOCOMP Can Truncate

PSS ID Number: Q32159 Article last modified on 04-21-1993

3.00 MS-DOS

Summary: The “Microsoft COBOL Compiler for MS-DOS: User’s Guide,” Pages 2-17 states the following about COMP code: This COMP code produced by the compiler behaves in a way that is not the ANSI standard in cases of numeric overflow.&quot; Data defined as computational (COMP) is stored in binary code. Without the COMP compiler directive, the value that may be stored in PIC 99 COMP-#, for example, is restricted to less than 100. If the COMP compiler directive is used, the compiler allows values up to 255 (0FFh) to be stored in a PIC 99 COMP field. The result of using the COMP directive is that if a PIC 99 COMP field is moved to a PIC 99 DISPLAY (NOCOMP) field, truncation will occur if the value in the COMP field is larger than 99.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.