Question

I have a COBOL program which generates a sequential file with this structure:

FD ALUMNOS-FILE.
01 ALUMNOS-DATA.
    88 EOF                 VALUE HIGH-VALUES.
    05 STUDENTID           PIC 9(7).
    05 STUDENTNAME         PIC X(10).
    05 FILLER              PIC X(8).
    05 COURSECODE          PIC X(4).
    05 FOO                 PIC S9(7)V USAGE COMP-3.

If I open the file in Notepad++, I see strange unicode symbols which are difficult to read caused by the COMP-3 variable. Something similar to the image below (the image is from another file):

enter image description here

Is there any way without using COBOL to rewrite this sequential file to be readable? Maybe using a script language like VBS? Any tip or advice will be appreciated, and if you need more info let me know and I'll edit the post.

Was it helpful?

Solution

I would suggest having a look at the Last Cobol Questions

But the RecordEditor will let you view / edit Cobol Files using a Cobol Copybook. In the RecordEditor you can export the file as Csv, Xml if you want.

As mentioned in the Last Cobol Questions there are several solution for Reading Cobol files in Java and probably some in other languages.


To import the Cobol Copybook into the RecordEditor, Select: Record Layout >>> Import Cobol Copybook

Import_Cobol_Copybook

The File-Structure controls how the file is read. Use a File-Structure of Fixed length Binary if all the records are of the same length (no carraige return).

Other Structures supported include

  • Standard Text files File Structures: ** ..Text.. **
  • Cobol Variable Record Length Files. These Typically have a Record-Length followed by the Data. There are versions for Mainframes, Open-Cobol, Fujitsu.
  • The Default File structure will choose the most likely File-Structure based on the Record-Definition. In your case it should choose Fixed length Binary because there is a binary Field in the Definition.

Note: From Record Editor 0.94.4, with a File-Structure of Fixed Length Binary you can edit Fixed Length Text files in a basic Text Editor if you want.

Note: I am the author of RecordEditor

Answer Updates 2017/08/09

Conversion Utilities

For simple Cobol files these conversion utilities (based on JRecord) could be used:

  • [CobolToCsv][5]
  • [CobolToXml][6]
  • [Cobol To Json][7]

RecordEditor

The RecordEditor has a Generate option for generating Java / JRecord code. See [RecordEditor Code Generation notes][8]

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top