Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using GNUCobol to convert systems writtrn in cobol to C

Status
Not open for further replies.

whoyou

Programmer
Nov 24, 2005
6
IL
Hi, Just wondering if using the C code that GNUCobol compiles to would it be possible to convert COBOL programes/systems to C?
If so you can put all us old Cobblers out to pasture!
 
Possible? Yes. A good idea? No.

If you've ever looked at the generated C code, it's not tight and concise code. It's generated code that has a lot of added bloat to allow it to mimic how a running COBOL program acts. It also was never intended to be used as a language converter, except to get the code past a C compiler, so it's not very human friendly code. Because of these reasons, yes it will create some C code that mirrors the function of the COBOL program, but it will be an impossible to maintain and enhance pile of fairly ambiguous C.

If you were needing to move your code base from COBOL to C, I would get some programmers that are fluent in both. They do exist. Look for grey hair and wrinkles. [bigsmile]
 
Thanks for your reply Sam, makes sense.
Can I use GNUCobol to develop / maintain cobol programs running on mainframes?
 
Can"?!?

Again, yes you can. Should you? Probably not.

GnuCOBOL translates the COBOL source to C, then runs it through the Gnu C compiler. I believe the only "mainframe" that the Gnu C compiler can target is an IBM 390 running Linux. I don't think it can natively target a non-Linux OS except for Windows or Mac OS/X. I could be wrong, but I wouldn't mix environments.

In general, you should always develop and maintain code on the same architecture as your production environment. If you are programming for a mainframe, you should be using a native compiler for that HW/OS combination. That will save you many headaches and huge expense in the long run.

There is a GnuCOBOL FAQ that explains a lot about it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top