Absent Member.
Absent Member.

decimal to Cobol Numeric

Strange results occurring with the attached piece of code.  The CalcPerecntDotNet method is returning mixed results when you divide 100 by the following numbers 13 thru 15, 17 thru 19, 21 thru 24.  FYI, I stopped testing at 100.  The CalcPercentCobol method seems to work correctly.  Also it should be noted that the piece of code that is causing the problem is when I try to move the Decimal field to the Pic 9(03)v99 field using the set command. 

Below I provided the values 13 thru 24

passed value CalcPercentCobol CalcPercentDotNet
13 7.69 707.54
14 7.14 706.99
15 6.66 706.51
16 6.25 6.25
17 5.88 705.73
18 5.55 705.4
19 5.26 705.11
20 5 5
21 4.76 704.61
22 4.54 704.39
23 4.34 704.19
24 4.16 704.01
Tags (1)
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: decimal to Cobol Numeric

Please create a support incident for this problem and reference my name in the description so that it is assigned to me.

I will create an rpi for this behavior so that we can get it fixed.

I can reproduce the problem using the following:

      working-storage section.
      01  mydecimal     decimal value 13.
      01  result        decimal.
      01  mynumber      pic 9(3)v99.
      procedure division.
           set result to 100 / mydecimal
           set mynumber to result


The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.