4 ms·
the few I've seen, COBOL legacy is its own kind. It meshes decades of users, practices, tools and paradigms. We've been shown code that blend old original code
by agumonkey 4y ago
the few I've seen, COBOL legacy is its own kind. It meshes decades of users, practices, tools and paradigms. We've been shown code that blend old original code with 3GL crude code generator with 4GL custom COBOL transpiled DSLs with monkey patching. It was really not pretty (to stay polite).
- hermitdev 4y agoMy last project as an intern was to rewrite an old batch processed COBOL app into a simple webform in C#/ASP.Net. The COBOL app was nothing special, really. From what I recall, it was around 65 pages printed. Took me a while to comprehend what was going on, but the first 80% or so was basically just hard-coded rules to take action on based upon user input. Things like when "B", generate "X" & "Y". When "A", generate "X", "Y" & "Z" sort of thing. Nothing fancy, at all. Once I figured out what was going on, I basically just ran the COBOL through some regexs, transformed into an XML doc (don't judge me - it was early 2000s) and wrote the rules engine in maybe one or two screenfuls of C#. I did learn one thing, and that was COBOL has one up on 'goto'. Check out the control flow statement: MOVE NEXT SENTENCE. It's basically a goto, but it doesn't jump to a label, per se. Instead, it jumps to the next period in the source. Yes, in a big, blocky, verbose language like COBOL, where everything is in UPPER CASE, you're now looking for a teeny tiny period that is easily lost in the verbiage. Hands down, my least favorite programming language construct ever.
- agumonkey 4y agoYou never ran into an ALTER ?
- JD1967 4y agoNEXT SENTENCE (not "MOVE NEXT SENTENCE") is sort of equivalent to "continue" in modern languages. In more "modern" COBOL's like COBOL-85, there is actually a "CONTINUE" which is essentially a no-op. Some COBOL shops instituted a "one-period-per-paragraph" rule (on the last statement in a paragraph) to avoid some of this. And COBOL-85 (thankfully) added scope delimiters (i.e. END-IF) to help avoid the issues with periods.
- ElectricalUnion 4y ago> COBOL transpiled DSLs That problem happens with any transpiled language really, now you have all the problems of the new language and all the problems of the target language, and you need to fix "supposedly compiled" output by hand sometimes.
- agumonkey 4y agoI've nothing against cobol, but I think it's worth there, because of the gap with a python like lang (IBM made one) and cobol. Coffeescript to es5 wasn't too hard to guess.