title: COBOL - Differing answer from mainframe to PC for same COMPUTE
body: <p>I have this very simple dummy COBOL program which does a dummy COMPUTE and displays the result.</p>
  
  <pre><code>   ID DIVISION.
     PROGRAM-ID. DUMMYPGM.
     DATA DIVISION.
     WORKING-STORAGE SECTION.
     01 NUM-A PIC 9(3) VALUE 399.
     01 NUM-B PIC 9(3) VALUE 211.
     01 NUM-C PIC 9(3).
    *
     PROCEDURE DIVISION.
     MAIN.
         COMPUTE NUM-C = ((NUM-A / 100) - (NUM-B / 100)) * 100
         DISPLAY 'NUM-C IS ' NUM-C
         STOP RUN.
  </code></pre>
  
  <p>When I compile this code on a mainframe (with compiler MVS Enterprise COBOL V4.2) and execute it, I get "NUM-C IS 100", probably because (399 / 100) is treated as a 3 instead of a 3.99 in the calculation (and same goes for 211 / 100).</p>
  
  <p>But when I compile the same exact code on a PC (with the GnuCobol compiler) and execute it, I get "NUM-C IS 188".
  The PC's answer is correct , but I would like to make it behave like the mainframe (and thus, losing precision in that compute statement to give 100 instead of 188)... How would I do that ? </p>
  
  <p>The reason for the above is a general expression of this code:</p>
  
  <pre><code> COMPUTE PDISCR = (((((X(1) + DX - XBRAK) * (ABRAK(1) / 1000)) / 100)
                    + PHT(1) + DPH - PHBRAK) * 2) + ((V(1) + DV 
                    + VBRAKMPM) * (V(1) + DV - VBRAKMPM) / 100000)) 
  </code></pre>
  
  <p>This is part of a 50-year-old Train simulation program, which I need to migrate to GnuCOBOL. All the fields used in the COMPUTE are integers. I need to be able to get the same answer from GnuCOBOL.</p>
  
  <p>Confirmed for OpenCOBOL/GnuCOBOL up to 2.0.</p>