Forum Discussion

Pkrishna9494's avatar
Pkrishna9494
New Contributor
2 years ago

How to read cobol binary file

Input :

צנקננפקננשנעעס –Pƒ\ @ @@@@ | ננץ@@@@@@@@@@@@@@@@@@@@@@@@@@@2 <נננננ@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@0 yD\  @@@@סננסעע

 output:

" 00000000000000000000000000000000000607.","0047026315"," 00000000000000000000000000000000000001."," 0000000000000000000000071341.3800000000","0","0"," 0000000000000000000000000000.0000000000",""," 000.","","0","0"," 0000000000000000000000000000.0000000000"," 00000000000000000000000000000000000005.",""," 00000000000000000000000000000000032003."," 00000000000000000000000000000000000000."," 00000000000000000000000000000000000000.",""," 00000000000000000000000000000000000000.",""," 00000000000000000000000000000001240301."," 0000000000000000000000000653.2300000000"," 00000000000000000000000000000000000000."," 00000000000000000000000000000000000000.","","10","01","22",""

5 Replies

    • Pkrishna9494's avatar
      Pkrishna9494
      New Contributor

      can you possible  to read through python script 

  • it's fixed width format and character set EDCDIC to UTF-8 through python script, could you please help me out 

    • Pkrishna9494's avatar
      Pkrishna9494
      New Contributor

      it's fixed width format and character set EBCDIC to UTF-8 through python script, could you please help me out 

  • sshaik's avatar
    sshaik
    New Contributor III

    Hi Krishna

    You have to setup a file in Cobol copybook parser , file name like dataformat.cfd

    And the data inside file is like  below one

     

    ******************************************************************
    * COBOL DECLARATION FOR THE DATA
    ******************************************************************
    01 RECORD-1.
    02 Field1 X(10).
    02 Field2 X(3).
    02 Field3 X(2).
    02 Field4 X(1).
    02 Field5_PIC X(2).
    02 Field6_PIC X(2).
    02 FILLER_PIC X(1).
    ******************************************************************
    * THE NUMBER OF COLUMNS DESCRIBED HERE IS 8
    ******************************************************************

    and here X()  should represents the width, you have to check with functional on this exact width.

    01 --- is the entire record

     From 02-- are the column names