title: Reading a mainframe EBCDIC File
body: <p>I have a EBCDIC coded mainframe file which I need to convert to an ASCII format. Which libraries/tools can I use to do that. I am most familiar with Python. </p>
  
  <p>The file I received has a cookbook with it, which can be used to parse the file (part of it is below).</p>
  
  <p>What do types: 'C', 'P' and 'B' mean? I'm guessing C = character, B = byte, P = packed number?</p>
  
  <pre><code>1:----------------------------------------------------------------------------------------------------------------------------------:
   :LAYOUT NAME:         B224E           DATE:    02/20/14         PAGE   7 OF  14:
   :                     -------                  --------              ---    ---:
   :COBOL:  PAN-NAME: NONE                 COPYLIB-NAME: RECB224E                 :
   :                  --------------------               --------------------     :
   :BAL  :  PAN-NAME: NONE                 COPYLIB-NAME: NONE                     :
   :------------------------------------------------------------------------------:
   :TYPE OF RECORD:  EXTENDED SORT KEY AREA - SEGMENT "A"  (OPTIONAL)             :
   :------------------------------------------------------------------------------:
   :POSITION  : LENGTH : TYPE :   DESCRIPTION                                     :
   :----------:--------:------:---------------------------------------------------:
   :          :        :      :                                                   :
   :          :        :      :                                                   :
   :          :        :      :                                                   :
   :001 - 001 :    1   :   C  :  SEGMENT IDENTIFIER - "A"                         :
   :          :        :      :                                                   :
   :002 - 003 :    2   :   P  :  SEGMENT LENGTH                                   :
   :          :        :      :                                                   :
   :004 - ??? :   ???  :   C  :  EXTENDED SORT KEY AREA                           :
   :          :        :      :                                                   :
  </code></pre>