Shouldn't it be possible to convert COBOL to C C++ LLVM IR or even WebASM?
Don't hate COBOL until you've tried it
131–139 of 139 posts
Re: Don't hate COBOL until you've tried it
#132Shouldn't it be possible to convert COBOL to C C++ LLVM IR or even WebASM?
It’s certainly possible; after all, the GnuCOBOL compiler is written in C. A large part of every COBOL program tends to be simple move and arithmetic statements that seem like they should be easy to port. The difficulty comes with the data declarations. COBOL’s pic statements don’t just define length and whether or not they’re numeric. They also come with complex behaviors that are enforced at run time. For example,…
Re: Don't hate COBOL until you've tried it
#133Re: Don't hate COBOL until you've tried it
#134Earlier quoted context omitted.
It’s certainly possible; after all, the GnuCOBOL compiler is written in C. A large part of every COBOL program tends to be simple move and arithmetic statements that seem like they should be easy to port. The difficulty comes with the data declarations. COBOL’s pic statements don’t just define length and whether or not they’re numeric. They also come with complex behaviors that are enforced at run time. For example,…
Wouldn't that just mean using functions to have the same results?
add x to y giving z
become something like
cobol_add_giving(&a, &b, &c);
which is a lot less readable.
Re: Don't hate COBOL until you've tried it
#135I have not used COBOL for 30 years but the language deserves respect. The transition from assembler to COBOL was one of the biggest productivity improvements in the history of programming, comparable to the introduction of Java and VM-based programs in the 1990s. COBOL is still pretty efficient for tasks like scanning data on magnetic tapes--not that most of us do that any more. In fact it was pretty good for any pro…
The best thing about COBOL is the distinct lack of hipster coders or frameworks. I worked on various COBOL code bases over the years, and they were always approachable, if a little long-winded. My cheques still process via COBOL code a friend's grandmother wrote and still runs on emulated Unisys hardware.
Re: Don't hate COBOL until you've tried it
#136Earlier quoted context omitted.
Sure, if the money was right. I actually know a bit of COBOL, most of it forgotten. After a while I would move on if they didn’t give me other projects, but I’d even be willing to do it in parallel.
Not sure if I understand you. Isn't "if the money was right" another way of saying "if forced by the customer/platform"? In other words, if the customer told you "pick the language you want" and the platform wasn't a mainframe, why would you choose COBOL?
Re: Don't hate COBOL until you've tried it
#137I have regualr talks with people who were using COBOL a while ago. There are things were cobol is good : 1/ COBOL run in closed environments. This allows these to be rock solid. (no such thing as a dependency nightmare). You don’t have such a thing as different version of Java on your testing and production environment. 2/ COBOL forces you to mix concerns : DB access, file I/O, business logic. This is sometimes usefu…
Both Go and Java can do that (yes, without having to install a JVM on the target machine).
Re: Don't hate COBOL until you've tried it
#138Once in a while I decide I want to play with COBOL, so I install GNU COBOL, dig out my old test code and try to use it to do something interesting. So, most recently I wanted to simply read a file, do some simple processing and then write an output file. Very basic, right? Not so much with COBOL. First you have to statically declare the files you want to use. Let's say you want to read from "foo.txt": environment div…
It's certainly true that there's a lot of boilerplate verbosity involved in reading files in COBOL. But once you've done that, parsing out the fields will likely be much simpler than in most modern languages. Records like this are still produced at government agencies such as the US Census Bureau. I've often wondered if it might be simpler to do the parsing in COBOL and then pipe it to another language to do the rest…
Re: Don't hate COBOL until you've tried it
#139Earlier quoted context omitted.
> But how complex can these programs be? Surely anything written before 1992-ish can’t involve that much code just because of the limitation of the machines they were designed to run on. What makes it that expensive that no one wants to rewrite them in a modern language? You would be utterly shocked. I did some COBOL work for a bank. Most of the new code they write is in C++. However, COBOL was still a huge part of t…
> I did some COBOL work for a bank. > Most of the new code they write is in C++. Sounds like jumping from the frying pan into the fire.