6

What differences are there between the top level architectures of Cobol and Java?

What are the styles and cultures that programmers adopt in these two languages?

How can one best port from Cobol to Java?

JaakkoK
  • 8,247
  • 2
  • 32
  • 50

3 Answers3

3

I was the project leader for the project NACA mentionned above (automatic transcoding from cobol to java for 4 millions lines of Cobol).

If you have any specific question, please feel free to get in touch with me via a comment at the bottom of my article mentioned above.

We've had lots of projects around the world reusing our tools with good success. We still improve them on a regular basis (check out http://code.google.com/p/naca) to fulfill the needs of those projects based on NACA tech.

Bridge
  • 29,818
  • 9
  • 60
  • 82
2

Theres an interesting book available for a $1 (paperback) that may help in such an endeavour, 'Java for Cobol Programmers' by John C. Byrne http://amzn.to/bKqc5j

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131
2

Both are invocation stack based languages and both support object oriented and procedural styles of programming. However you will find very little benefit of porting to Java if you just rewrite procedural code in a giant main() method with static subroutines. You will likewise find very little Cobol code that takes advantage of the object oriented features of the language.

As Cobol is primarily used for applications involving money, Cobol shops and programmers tend to focus more on the business side of things, less on the write-elegant-and-beautiful-code side of things. The Cobol to Java ports I have seen tend to have one class, all variables are declared at the top as static and the main() method calls a bunch of static methods much in the same way it was performed paragraphs or call subprograms.

The Java to Cobol ports I have seen tend to be the exact opposite -- they use the OO extensions that most Cobol programmers never use, at all.

If you are in an IBM Enterprise Cobol shop, there really isn't a need to port. The two languages inter-operate nicely and you can replace new parts with Java and still interact well.

But the best way to truly port from Cobol to Java is to learn both languages and paradigms well; document the existing functionality of the Cobol system in great detail; then design and write a new OO style Java system that will also have that functionality.

Joe Zitzelberger
  • 4,238
  • 2
  • 28
  • 42
  • You've seen a Java-to-COBOL port? Where? While abstractly it is interesting, I didn't think anybody would actually do that. What's the motivation? – Ira Baxter Mar 17 '12 at 21:05
  • The motivation is that for almost 20 years the universities have been cranking out OO-trained java programers and no Cobol programmers. The bean counters see this and think it is time to shift/migrate/reposition/whatever so that they can hire cheap talent and accomplish the same workload. Whether that is a sane strategy or not is a topic best left for another thread. – Joe Zitzelberger Mar 18 '12 at 04:59
  • Based on the fact that universities have been cranking out OO programmers, I can understand (and hear it all the time) managers wanting to convert COBOL to Java. The question was, "Java TO Cobol"? That isn't justified by the presence of more Java programmers... at least I've never heard that, and I operate in the migration space. – Ira Baxter Mar 18 '12 at 19:47
  • I've seen Java-To-Cobol ports when things are not performing very well on z/OS. Moving things to a native compiled language seems to be a good option over the tragically underperforming WebSphere on z/OS. But I've seen more Cobol-To-Java ports than the other way. – Joe Zitzelberger Mar 19 '12 at 00:08