3

I have a COBOL data file without a file extension. I need to convert it to any type a modern data file such as mentioned above. I can open the file with Notepad on Windows.

Here is a sample of the code inside

0~      9401131218264194011312182641 >                 ֽ   ֽ                                             A ֵ                @ֽB1993120901758501000232GE93DO   2PECALR                                                                   1MF000232Y      A10000                                                                           @ֽB1993120901758601004407GE93DO  % 2PECALR                                                                   1MF004407Y      A10000                                                                           @ֽB1993120901758701005444GE93DO  `2PECALR                                                                   1MF005444Y      A10000                                                                           @ֽB1993120901758801000008GE93DO   2PECALR                                                                   1MF000008Y      A10000                                                                           @ֽB1993120901758901001518GE93DO  €2PECALR                                                                   1MF001518Y      A10000                                                                           @ֽB1993120901759001000102GE93DO  €2PECALR                                                                   1MF000102Y      A10000                                                                           @ֽB1993120901759101001605LA93LA   2                                                                         2MF001605N      A20000                                                                           @ֽB1993120901759201001076GE93DO  P 2PECALR                                                                   1MF001076Y      A10000                                                                           @ֽB1993120901759301001608GE93DO  % 2PECALR                                                                   1MF001608Y      A10000                                                                           @ֽB1993120901759401007044GE93DO  5 2PECALR                                                                   1MF007044Y      A10000                                                                           @ֽB1993120901759501000329GE93DO P 2PECALR                                                                   1MF000329Y      A10000                                                                           @ֽB1993120901759601000613MM93MS  P 2PECALR                                                                   1MF000613Y      A10000                                                                           @ֽB1993120901759701000516MM94MS   2PECALR   

I don't even know where to start looking on how to accomplish this. Any help would be much appreciated.

boruchsiper
  • 2,016
  • 9
  • 29
  • 53
  • 1
    Lots of good information in this related question: http://stackoverflow.com/questions/4877379/reading-a-cobol-generated-file – barrowc Nov 01 '11 at 00:47
  • Unless you can provide a record definition or some other description of what this file contains its just a bunch of meaningless bits and bytes. The fact that it was generated by a COBOL program does not add or detract from the difficulty of decoding it. Data are data - information about the structure of those data are needed to interpret them. – NealB Nov 01 '11 at 13:46
  • Usually when you wanna get `COBOL file` downloaded into CSV format, you need to have different columns defined in a format and separated by a `special character`, which will be later used on windows to convert the file into csv format. Am i clear? – Raja Reddy Nov 07 '11 at 17:31

4 Answers4

4

What you've got here is not really a COBOL data file per se. It's a flat data file without a structure imposed on it. It certainly could be written by a COBOL program.

What you need to make sense of this would be a copybook that defines what the various data fields even are. While I can't be sure, if I had to hazard a guess I'd say that this is header material

0~ 9401131218264194011312182641 > ֽ ֽ A ֵ

and then you have multiple records, each one starting at @. This would likely be one record:

@ֽB1993120901758501000232GE93DO   2PECALR                                                                   1MF000232Y      A10000    

Now what you need is the structure. Do you have access to the COBOL source code? Without it (or else a copy of the copybook) I'm afraid there's probably no way to determine what this data is supposed to signify.

Marcus_33
  • 464
  • 3
  • 7
2

If you have to do this over and over or the file is very long, there are two things you can choose from

Write a program in cobol that will add commas between the fields and create a new file. You can then open that file as a csv in Excel.

OR

Write an excel macro. In one sheet provide the structure i.e. the type of the field in one column and the length in another column. The macro will read the structure of the file and split the text in multiple columns based on their length. You can look at this link for some idea on how to write the macro.

blvdeer
  • 146
  • 5
0

The FileWizard in RecordEditor / JRecord can search for Mainframe Cobol fields in a Files. The FileWizard results can be stored in a Xml file for use in other languages or you can use the copy Function to copy from Ebcdic to either Ascii fixed or CSV formats.

There is some out of date documentation on the File Wizard

Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
0

Well, since it's COBOL output every field length will be consistent from record to record.

If this is a one-time task I'd just open it in excel and use text to columns and manually set split points to get each field into its own cell.

If this isn't a one-off I'd just modify the program that produces the output to have a comma between each field in the output record.

Fuser
  • 144
  • 4