title: Reading a Cobol generated file
body: <p>I’m currently on the task of writing a c# application, which is going sit between two existing apps. All I know about the second application is that it processes files generated by the first one. The first application is written in Cobol.</p>
  
  <p>Steps:
  1) Cobol application, writes some files and copies to a directory.
  2) The second application picks these files up and processes them.</p>
  
  <p>My C# app would sit between 1) an 2). It would have to pick up the file generated by 1), read it, modify it and save it, so that application 2)
  wouldn’t know I have even been there.</p>
  
  <p>I have a few problems.</p>
  
  <ul>
  <li>First of all if I open a file generated by 1) in notepad, most of it is unreadable while other parts are.</li>
  <li>If I read the file, modify it and save, I must save the file with the same notation used by the cobol application, so that app 2), doesn´t know I´ve been there.</li>
  </ul>
  
  <p>I´ve tried reading the file this way, but it´s still unreadable:</p>
  
  <p>Code:</p>
  
  <pre><code>        string ss = @"filename";
  
          using (FileStream fs = new FileStream(ss, FileMode.Open))
          {
              StreamReader sr = new StreamReader(fs);
              string gg = sr.ReadToEnd();
          }
  </code></pre>
  
  <p>Also if I find a way of making it readable (using some sort of encoding technique), I´m afraid that when I save the file again, I may change it´s original format.</p>
  
  <p>Any thoughts? Suggestions? </p>