Converting C# to COBOL

Description

I did a previous article, (August 22, 2009) on converting the many C# examples to COBOL. At the time there were a few examples out in the world of how to perform this conversion. Since that article has been written more and more examples have been popping up.

In this article I'd like to introduce you to a co-worker of mine who has presented what I believe to be the ultimate wall chart. This article is intended to be used as a model for you to follow when you run into a C# example and need to convert it to COBOL.

Visual COBOL!

I recently published a blog about a new product being introduced by Micro Focus called 'Visual COBOL'. Visual COBOL will be a whole new product from Micro Focus, not a rebranded current version of one of the compilers. Visual COBOL will have new syntax available that will make coding COBOL in the .NET environment much simpler and stream lined. In my previous article I proposed creating two projects, one in COBOL and the other in either C# or VB.NET. This was to enable you to learn the art of utilizing, and hopefully understanding, the realm of .NET namespaces and classes. By using the other .NET languages you could see how the syntax was composed and then translate that into COBOL. I used this method because there was no really good reference material out there at the time.

Well guess what...someone created what I believe is the ultimate syntax example. A while ago I was in Newbury at our headquarters testing the latest release of Visual COBOL. I had the pleasure of meeting some very talented developers. One of them, Dr. Alex Turner, had mentioned he composed a chart showing the syntactical differences between C#, VB.NET and COBOL. NET. My initial thought was that's cool, a couple more examples that we can use and blog about. Man was I ever wrong! Alex, I publicly apologize for underestimating your resourcefulness!

Syntactical Differences, or the "Mother of all Syntax Charts"

Below is an example of the type of information Alex has composed in his chart.


Image01.jpg
 
If you'll notice on the chart there are three columns, one each for VB.NET, C# and COBOL. Alex has created one of the most in-depth, detailed charts of syntactical comparison for .NET that I have ever seen. Maybe these exist somewhere in the wide open internet but I doubt they exist with a COBOL version!
Alex has identified over 19 different areas for comparison, ranging from the basic program structure, to arrays, properties, enumerations and other key elements of .NET programming. From his chart you should be able to identify the basic constructs of a statement, be able to replicate that statement in your environment and finally expand upon what has been presented to further your coding.

As this topic has already been discussed I won't delve further. The intent of the article was to present updated material to you to keep you informed and hopefully make your task(s) easier to complete. The complete chart Alex has prepared is attached in the zip file. Please feel free to print and reference as necessary. It's become one of the key documents on my desk.

Wrap-Up

Micro Focus is continually expanding the breadth and depth of the COBOL language in the .NET environment. New syntax and expanded classes are being exposed and enhanced. While this article was short in nature it's intent, as with all the articles, is to provide you the reader with access to current and relevant information about developing with COBOL in the .NET environment. If you have any examples or questions please feel free to email me. As always...
Happy Coding!

Up Next
    Ebook Download
    View all
    Learn
    View all