Moving Zeros to COMP-0 Elementary Group Items

PSS ID Number: Q10132
Article last modified on 11-16-1992

2.00 2.10 2.20
MS-DOS

Problem:
   If zero is MOVEd to a group item consisting of one COMP-0
elementary item and is then displayed, the value "13226" is printed
rather than zero. Zero is displayed if the elementary item is not
defined as COMP-0, or if the COMP-0 variable is zeroed by a VALUE
clause. This problem does not occur in COBOL Version 1.12.

Response:
   Moving zeros to the group item actually moves two digits of ASCII
zeros to the elementary item. ASCII zero has a hex value of "30," so
the memory at the group item looks like "3030". Displaying the
elementary item after a MOVE of this nature displays the decimal
equivalent of "3030" hex, which is the value "13226".
   Moving zeros to the elementary item actually moves two digits of
binary zeros to the elementary item. Binary zero has a hex value of
"00", so the memory at this level looks like "0000". Displaying the
group item after a MOVE of this nature would display "00".
   In all versions of COBOL, if zeros are moved to a group item, it is
treated as an alphanumeric move; ASCII zeros are moved, not binary zeros.
   In Version 2.00, when a binary value is DISPLAYed, it is converted
to ASCII; thus, "3030" hex prints as "13226".
   In COBOL Version 1.12, if you display the bytes of a binary item
without conversion, the "3030" prints as "00". The contents of the
elementary item are interpreted in arithmetic as "13226", not "0".
Only the display gives misleading information.

Copyright Microsoft Corporation 1992.