Comp-X behavior

We have a variable defined as Pic X(5) Comp-X. This is able to handle 13 digits, which it does. However, whenever we move this value to a alphanumeric field, which is defined as Pic X(13), the high order digit is dropped and the field contains 12 digits and a space. If we would move the comp-x field to a numeric field, that is defined as Pic 9(13), and then move this to the alphanumeric field it moves all 13 digits correctly. There seems to be a bug in the way that Micofocus moves the comp-x field to alphanumeric. Is there a compile setting that must be used to get the correct behavior?

Parents
  • Yes, the value 1099511627775 is 13 digits, but the type of the data item described by Pic X(05) Comp-X is 12 digits, and that is what is relevant in a move from numeric to alphanumeric.  Micro Focus is not "off by 1 byte" except by your interpretation and even then it would be off by 1 digit (not byte).  

    Yes, the length of Pic 9(13) Binary(5) is 5 bytes (that's what the 5 in parentheses following Binary means), just like a Pic X(05) Comp-X (where the Pic X(05) specifies 5 bytes).  The problem with Pic X(05) Comp-X is that for COBOL purposes, a digit-length must be implied and Micro Focus chose the digit length that would always fit.  How ACUCOBOL chose to resolve the difference between binary representations and decimal representations in a decimal language such as COBOL is not relevant to the argument, only to an observation that this represents another ACUCOBOL vs. Visual COBOL compatibility issue in the subtle area of automatic conversion from binary to decimal to alphanumeric.

Reply
  • Yes, the value 1099511627775 is 13 digits, but the type of the data item described by Pic X(05) Comp-X is 12 digits, and that is what is relevant in a move from numeric to alphanumeric.  Micro Focus is not "off by 1 byte" except by your interpretation and even then it would be off by 1 digit (not byte).  

    Yes, the length of Pic 9(13) Binary(5) is 5 bytes (that's what the 5 in parentheses following Binary means), just like a Pic X(05) Comp-X (where the Pic X(05) specifies 5 bytes).  The problem with Pic X(05) Comp-X is that for COBOL purposes, a digit-length must be implied and Micro Focus chose the digit length that would always fit.  How ACUCOBOL chose to resolve the difference between binary representations and decimal representations in a decimal language such as COBOL is not relevant to the argument, only to an observation that this represents another ACUCOBOL vs. Visual COBOL compatibility issue in the subtle area of automatic conversion from binary to decimal to alphanumeric.

Children
No Data