|
|
|
|
|
by waltman
3162 days ago
|
|
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, anything that’s a pic 9 is stored as a sequence of 0-padded text digits, but you can also do arithmetic on them. They work like a car odometer in that if you add 1 to a variable that’s all 9’s, the result is all 0’s. They also allow you to do arithmetic on currency amounts (like I do in the article) exactly, without having to worry about IEEE floating point round off errors. That’s another reason the banking industry likes COBOL. |
|