title: How to display the actual value of a comp variable in cobol
body: <p>I have the following variable in COBOL program which gets its value from a file, when it is read:</p>
  
  <pre><code>01 Employee-number PIC 09(8) comp
  01 Employee-number-x redefines 
     Employee-number PIC x(04)
  </code></pre>
  
  <p>I have another variable in the same program:</p>
  
  <pre><code>01 D-element-number PIC 9(04)
  </code></pre>
  
  <p>Now, </p>
  
  <p>Move <code>Employee-number</code> to <code>D-element-number</code></p>
  
  <p>Then I write this <code>D-element-number</code> to a file</p>
  
  <p>value read from input file is :</p>
  
  <pre><code>0013 
  0024
  </code></pre>
  
  <p>so this value comes to <code>Employee-number</code> and <code>Employee-number-x</code> and I move this value to <code>D-Element-number</code> and write this variable to a output file.</p>
  
  <p>But I get this in the output file:</p>
  
  <pre><code>4660
  FFFF
  4660
  </code></pre>
  
  <p><code>4660</code> is the decimal equivalent of <code>X'1234'</code></p>
  
  <p>But I want to see something like:</p>
  
  <pre><code>1234
  FFFF
  1234
  </code></pre>
  
  <p>How can I achieve this ?</p>
  
  <p>I am allowed to change the definition of <code>D-element-number</code> but nothing else.</p>