boruchsiper
boruchsiper

Reputation: 2028

Need to Convert Cobol Data File to CSV, Excel

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.

Upvotes: 3

Views: 19555

Answers (4)

Bruce Martin
Bruce Martin

Reputation: 10543

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

Upvotes: 0

blvdeer
blvdeer

Reputation: 146

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.

Upvotes: 2

Fuser
Fuser

Reputation: 154

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.

Upvotes: 0

Marcus_33
Marcus_33

Reputation: 464

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.

Upvotes: 4

Related Questions