title: java program to convert EBCDIC to ASCII
body: <p>I wrote a simple java program to convert EBCDIC to ASCII. It's not working correctly. Here is what I did </p>
  
  <pre><code>Step 1: Convert ASCII file to EBCDIC using the following command :
  
   dd if=sampleInput.txt of=ebcdic.txt conv=ebcdic
  
   sampleInput.txt has following line :
  
  input 12 12
  </code></pre>
  
  <p>Step 1: generated ebcdic.txt</p>
  
  <p>Now, wrote following java program to convert ebcdic to ascii</p>
  
  <pre><code>public class CoboDataFilelReaderTest {
  
   public static void main(String[] args) throws IOException {
  
       int line;
       InputStreamReader rdr = new InputStreamReader(new FileInputStream("/Users/rr/Documents/workspace/EBCDIC_TO_ASCII/ebcdic.txt"), java.nio.charset.Charset.forName("ibm500"));
          while((line = rdr.read()) != -1) {
              System.out.println(line);
      }
      }
   }
  </code></pre>
  
  <p>It gave me wrong output, the output looks something like this :</p>
  
  <pre><code>115
  97
  109
  112
  108
  101
  32
  49
  50
  32
  49
  50
  </code></pre>
  
  <p>Please let me know what I am doing wrong and how to fix it.</p>