Search code examples
cobolgnucobol

COBOL (.cob) file cannot open due to unknown encoding


So I was helping my dad's small business in Taiwan migrate old COBOL application from a very old XP computer to a Windows 11 computer.

I copied all the COBOL files and installed OpenCobolIDE on the new computer. However, the IDE cannot open the file as the encoding is not correct.

Is there a simple fix? I spent the whole day playing with different IDEs but in vain. As I have zero knowledge of COBOL, if it is too difficult to migrate, I will probably write a complete new system for my dad. The one who wrote it has already retired and no one took over his job. Thank you! ................

Here are the details. The main file is TNMENU.COB. On the old computer, it was run by RM/COBOL, and the interface looks like this (it basically a menu of options)

On the new computer, the IDE cannot read the file. The hex values are given here.

I tried different IDEs, but all showed bad characters.


Solution

  • As you found out: There are a lot of hex values in your ".COB", so (as jimcastro) pointed out, those are not COBOL source files but compiled sources in a format that is loaded/executed from the old environment's runtime RM/COBOL.

    To move these to the new environment: as long as the RM/COBOL runtime is 32bit: just copy it along and use it on the new computer.

    If the runtime is 16bit it won't work on newer environments directly, you could try with an emulator or virtual machine (DOSBOX or FreeDOS running in VirtualBox for example).

    As an alternative: if the COBOL source code is available then you could recompile it with GnuCOBOL using -std=rm-strict, allowing you to run in in 64 (or 32) bit on nearly every operating system.