DEV Community

Quan Le
Quan Le

Posted on

This new tool converts Cobol code into Javascript in a blink

The tool is still in Proof of Concept phase and online demo is here: https://cobol-converter.com/ .

If you have tried to convert a Cobol system before, you must have heard of similar tools like this, converting Cobol code to some thing else, Java for instance. This new tool is very different, the result code (Javascript) is concise, and maintain the exact structure of the old Cobol code, so that anyone who is familiar with the old code can immediately recognize and understand the new code.

So why convert into Javascript? why not Java or something else?

Most people when they think about upgrading Cobol code, they think about Java, it's like a natural evolution. I happens to know both Java and Javascript very well, and I think Java is a very bad choice for this conversion. The reason is Cobol is both very declarative and flexible, whereas Java is strongly-typed so the result Java code will be very verbose, or worse, will have a totally different code structure that no one can recognize from the old code.

How far is this tool from production quality?

Very far. I also admit that I have no Cobol experience prior to this, and this tool is built in only 1 month in my free time. Nonetheless, this tool does prove the point that a fast and automated conversion is totally feasible, and it does so by breaking through several choke points:

  1. It fully supports "go to", "perform" and any other flow control operations that Java or Javascript (or any modern languages) do not natively support
  2. Readability: result JS code is succinct has same structure with Cobol code.
  3. Decimal precision: JS code maintain 100% numeric precision like Cobol code without sacrificing any code readability. It use Decimal.js lib underneath for precise numeric calculation.
  4. Performance: It is quite performant. Although JS by nature is not a very good CPU-bound execution environment, most Cobol program is IO-bound anyway, which is a JS strong point.
  5. I also added external file and sub programs support, just to test how far this can go. There are quite a few example projects that you can open from the "File" menu in demo app (link above).

The demo app also supports running the result JS code right in your browser, so you can try it out immediately, you can even run IO commands like "accept" (user input), or writing file out. Check it out.

I need your help.

As stated above, I am not a Cobol expert. I wrote this tool in a desire to solve the long standing problem that our IT industry is facing: the outdated Cobol systems are still in use today after 60 years of existence. However, I don't have the needed Cobol expertise to fully understand the real challenge here. This tool can be a good start, and with it I addressed the most prominent problems that I can see, but I am sure I haven't seen enough.

So, if you have Cobol experience, please come forward and help me. You can either tell me if there are still obstacles that I haven't seen, or just "this idea is plain stupid". I really don't want to put too much effort into this and later find out it is not going anywhere.

Sincerely and honestly, please help.

Thanks

Top comments (0)