4 ms·
Ex-COBOL developer here. In case anyone is wondering if something like this could ever be the "killer app" of COBOL that launches it into modern fame and glory
by Ovid 12y ago
Ex-COBOL developer here.
In case anyone is wondering if something like this could ever be the "killer app" of COBOL that launches it into modern fame and glory, the answer is "oh god, no."
COBOL isn't a modern language by any stretch of the imagination. For example, advanced math is something that it's particularly bad at. Or do you want to sort some data? Yeah, COBOL will let you sort some data, only if you specify the damned file containing the unsorted data, the file that will hold the data while it's being sorted, the file that will contain the sorted data (http://www.tutorialspoint.com/cobol/cobol_internal_sort.htm http://www.tutorialspoint.com/cobol/cobol_internal_sort.htm). Want to sort an array into another array? Screw you.
However, there's one thing that COBOL is very bad at: unstructured text. Guess what 99% of the Web is?
For example, in their sample code they show this in the working storage section:
01 the-values.
05 COW-query-values occurs 10 times.
10 COW-query-value-name pic x(90).
10 COW-query-value pic x(90).
Guess what "pic x(90)" means? The "x" means it can contain any data (not just alphanumerics), but the 90 means it must be 90 characters long. In other words, if you have color=blue in your query string, "color" will be 90 characters long (probably padded with 85 spaces), and "blue" will be the same (probably padded with 86 spaces).
Thus, when someone else declares color as "pic x(80)" (note the 80 versus 90), even if the color submitted is "blue" for each, one might be 80 characters long and the other might be 90 characters long and if you don't like it, too bad. Have fun comparing them.
COBOL is still the world's most popular programming language, though, if you look at it in terms of lines of code. Sadly, COBOL programmers are aging and there are fewer devs to maintain their programs (I started hacking on COBOL when I was 30 and I was the youngest developer in my department!).
- kyllo 12y agoI work at a company that is in the middle of a massive COBOL -> Java migration project. The core transaction processing system has 1.3 million lines of HP3000 COBOL that is pre-compiled to 13 million lines of Micro Focus COBOL, so that code can be compiled to run on UNIX hardware (using a mainframe emulator framework). So although I'm not a COBOL dev myself, I deal with the issue you describe constantly. Want to give an inventory item an identifier that's longer than 36 characters? Too bad! That field in the legacy system is PIC X(36) so it will get truncated to that length if it's longer (and of course, padded with spaces if it's shorter, so there are lots of String.trim() calls in our Java code).
- Ovid 12y agoDamn it! I totally feel your pain. Migrating COBOL to Java has long been one of my pet peeves. The former is procedural with all variables being global and fixed-width and the later is OO (sort of) with lexical variables of variable size. The two do not mix and match well. Trying to get away from COBOL is actually a three-way problem: technological (as we've alluded to), business (hey, we gotta stop using this shit!), and social (hey, I don't want to touch this shit!). Unfortunately, virtually every solution I've seen focuses on the business or technical issue in isolation, but ignores the others. I've actually found a solution that solves all of the issues and would make new developers excited to work in COBOL shops, but it's on hold until some technical challenges are surmounted. Frustrating as hell!
- kyllo 12y agoRight, there's a huge impedance mismatch between COBOL and Java, but couldn't you say the same for any other modern PL? I don't see how migrating COBOL to Python or Clojure or Haskell would be much easier than migrating it to Java. But yes, no one wants to touch the 30 year-old COBOL codebase with a ten foot pole. It's career kryptonite. I'd be curious to learn about the solution you're describing for this problem, is it something you can disclose in any detail?
- brudgers 12y agoThe C Programming Language is also not particularly good at unstruc#67Fy1D&]jp
- kyllo 12y agoWell yeah, not having a String type is kind of a deal breaker for web programming.