On COBOL
oreilly.com
oreilly.com
https://en.wikipedia.org/wiki/COBOL#Features
It's very verbose, and includes a lot of opaque language that almost seems designed to confuse (I know it wasn't actually, but it's pretty bad). For example, an alphanumeric variable type is called a `PIC` for "PICTURE". You can store an alphanumeric as a `PIC A`, or a numeric-only using a `PIC X`. Fields in a record get a "level number" that defines their behavior, and you just have to memorize which does what. 01 is a top-level record. 05 defines a subgroup. 88 is a conditional record.
There are many parts of the language that are clearly anti-features in retrospect. A 66 level number allows you to redefine a field in a previously defined record. Convenient in some cases maybe, but something that will clearly lead to maintainability problems as the shape of a record doesn't match its original definition in code. Another example is that COBOL has a huge vocabulary, with the original idea that you could write things as much like English as possible (e.g. use a `GREATER THAN` instead of a `>`), which is one of those things that probably seemed like a good idea at one point, but which every modern language has abandoned or is abandoning (through the use of linters, etc.).
The article makes quite a few salient points, but on the other hand, if there's ever been a language that got almost everything wrong in about as objective a sense as you can get when speaking about these things, it's this one.
Instead of inspiring the next generation of COBOL programmers, IMO there's a good alternative argument to be made for getting a bunch of smart people together to write a transpiler that could transform huge legacy COBOL codebases to something more maintainable, like how the Go team transpiled from C to Go, and vanquishing this language to the history books. Obviously very difficult, but something that'd pay off in the long run.
The real problem with COBOL imo, is that the language hasn't much improved since it's creation. While there have been some useful tweaks and changes, it has missed out on major items such as variable scoping/user-defined functions (all variables are global - the workaround is to use sub-programs and pass data in the call). Even "object-oriented" functionality as mentioned in the article was badly tacked on to the language and only complicates it without really adding much in terms of capability. Also, the language doesn't really have strings as in other languages, and consequently lacks the applicable functions.
Another major point that the article misses is that mainframe COBOL (most COBOL is/was mainframe and that means IBM) which does anything more than straightforward "read file,process contents,generate report" is inextricably linked to its environment. The article talks about poor form handling. COBOL doesn't do form handling. That would be CICS or IMS/DC software which the COBOL interfaces with. There is heavy integration in the code, but this is like confusing Java with Websphere or Tomcat. This is why it is so difficult to port COBOL systems to another language/environment. The COBOL code can be mechanically converted. But any complex system has calls to databases, transaction processing, and is built with batch jobs relying on JCL and system utilities. Replacing the environment while retaining the integration and reproducing the functionality is the hard part.
The COBOL 2002 standard includes form handling ("SCREEN SECTION"). However, IBM COBOL implementations never included that, and so you are correct that on IBM mainframes stuff like CICS and IMS/DC is used instead. Some COBOL compilers on other platforms did implement "SCREEN SECTION", e.g. Micro Focus COBOL on Windows/Unix, DEC COBOL on OpenVMS, Tandem NonStop COBOL, and COBOL software developed for those platforms did use it. It is also true that non-IBM mainframe COBOL is likely a minority of all COBOL software still in use.
Some technical mistakes in your post was already raised by another reply, and I just want to point out how the levels actually work. I've played around with COBOL on and off out of casual interest, but when the Oreilly COBOL book became available to me recently I decided to read it just for fun.
As it turns out, COBOL mixes the concept of variables and report definitions. To paraphrase an example from the book[1], which I can recommend:
01 date-of-birth.
02 year.
03 century pic 99.
03 year-in-century pic 99.
02 filler pic x value "-".
02 month pic 99.
02 filler pic x value "-".
02 day pic 99.
With that definition, you can read and write values to and from each individual field, but also access the higher level ones as a combined field. For example, if I assign a full ISO 8601 date to the variable date-of-birth, like so: move "2010-01-02" to date-of-birth
I can then read the year by simply reading the corresponding variable: display "year is ", year
It all becomes much more clear once one realises that variable definitions in COBOL are conceptually field definitions for reports and fixed column storage formats. If the task at hand matches the way COBOL thinks of data, things are pretty simple. Once you want to move outside that realm things becomes harder.My understanding is that in the mainframe world, COBOL programs are parts of much larger workflows, all coordinated by JCL scripts. Since all data is already in fixed column form, typing together these COBOL programs is similar to how you build pipes out of different programs when you write shellscripts in Unix.
[1] https://learning.oreilly.com/library/view/beginning-cobol-fo...
Learn COBOL if you want - I learned COBOL early in my career and it’s very interesting how different it is - but if you’re attempting to maximize salary you’re better off spending time learning the bleeding edge tech.
Mainframes are surprisingly transparent systems, if you learn where to look, compared to Unixes. There are many logging and tracing facilities that run all the time.
For these reasons, some people actually enjoy it more to work with these systems.
Ehhhh.... this in contrast to closed systems where there are layers of closed source which lead to all sorts of unexpected behaviour without the recourse of looking under the hood to find out what is going wrong. Closed systems are harder to debug than open source systems.
I generally like open source, but I am skeptical when it is used as a tool to save costs by companies. (Apache foundation projects are IMHO the worst offenders.) In some sense, commercial software is the devil you know.
No, older, established projects or products are the devils you know, whether they're free software or proprietary products. Take for example Debian Stable which is, as its name implies, stable but seen as fairly stodgy and unexciting. Stodgy and unexciting is what you want in a business environment. The mere fact that there are far newer releases with loads of new features (and bugs) does not mean that you need to use them, just wait for the next stable release.
This goes along really great with the closing paragraph of the article:
>That’s the new generation of COBOL programmers that we need: people to do the tedious, unglamorous work of re-inventing, re-engineering, and automating government applications, business applications, and much more. Reimagining these processes is creative work, but it requires a different kind of creativity from implementing a new website.
Gee, why is it that people are trying to hard to get into FAANGs rather than learning COBOL.
The alternatives were Assembly, FORTRAN and ALGOL.
However where COBOL rules is on mainframes, which after Assembly have always used PL/I derived systems programming languages (like Unisys, IBM i and z/OS), so on those systems C is just another guest language and hardly anyone cares to use it beyond porting software to their POSIX runtimes.
Cobol has had its last revision in 2014, supports modules, OOP, and even has .NET and JVM backends.
MicroFocus and Fujistsu also have frameworks for cloud deployments and writing microservices in Cobol.
Almost no one cares about C on mainframes beyond porting some POSIX stuff, or running Aix/Linux on an hypervisor.
Even BLISS and Mesa were better than C.
It would have been interesting if one of the PC operating systems had decided to use one of those languages.
So, no C, no interest in 'I need a C replacement language', enterprise software is boring, so no COBOL replacement. Plus, I know of at least one vendor who did develop something but it is kept in-house.
I did expect someone to develop yet another REXX to address this need.
I think, with Metal C, that's less true than it used to be.
My understanding is that, for brand new z/OS components (e.g. Zowe, z/OSMF), IBM prefers Metal C to PL/X. It is also seeing increasing use by mainframe ISVs as a replacement for assembly and PL/X.
ISVs definitely use it, not just IBM. Most z/OS user exits cannot use language environment, they must use either Metal C, assembly or PL/X. (And, outside of IBM, PL/X is only an option for those few companies who have bought PL/X licenses, which apparently IBM doesn’t even sell anymore.)
Also, historically there has been a big culture at z/OS sites of writing site-specific user exits in assembly. Less of a need for it nowadays given features in newer z/OS versions and ISV solutions, but some folks still do it. And Metal C is the only alternative to assembly that customers have.
For a real world example of where it is used, I used to work with a product that used RACF user exits to send security change notifications over the network to a Java app running on a Unix system, for auditing, scheduled access certification, etc. (The user exit in question was written in HLASM not Metal C, but if you were building the same thing from scratch today you’d quite possibly choose Metal C over HLASM. You can’t write a RACF user exit in C++ because that needs language environment and language environment use is not allowed in RACF user exits.)
However I would say that is exactly the example of a niche use case.
Application level stuff, nobody should use Metal C for that. Use Language Environment C/C++. But at application level, C and C++ are not very popular languages for z/OS. COBOL and Java are.
On IBM i, IBM used C++ heavily as a system programming language, especially as a replacement for PL/MP. By contrast, C++ has always been relatively niche on z/OS.
If you punched sequence numbers in the ignored columns 73-80, you could use an electromechanical card sorter to put the cards back in order if you dropped them.
Or if someone shuffled them (as we used to do in the computer room to people who annoyed us.)
This way a quick glance can tell you if the stack is out of order and it's also faster to sort manually.
If you want to convince people to learn COBOL, convince people you can have a great career as a COBOL developer, or at least as a developer with COBOL in your toolkit. I've yet to see anyone convincingly make that case.
I wouldn't have problem working in archaic language, thought I. Or with non-trivial codebases.
But then I've got another impression: the companies don't expect a new candidate just to knew the language and work with old codebases. They expect also the people to be able to work with ancient terminals, as in: no grep for you. Even worse it's "no ASCII for you." I.e. not a single tool to which I'm used I'd be able to use. Whatever I'm used to work with, I won't be able to use.
That's where I became demotivated.
However, yes, knowledge of how to operate 3270 terminal is required. And it has a form of grep, actually, as well as compare tools. EBCDIC is just another encoding, not a huge problem.
COBOL apparently still has major problems with UNICODE. COBOL in IBM land can only do UTF-16. Some IBM products are big-endian UTF-16, and some are little-endian UTF-16. COBOL (PeopleSoft version) in Oracle land can do UTF-16 and, sometimes, UTF-8 in programs for fields not stored in the database.
It's late for the language to be in that state.
COBOL was one of the original 3GLs, and appeared in 1959. The concept of 4GL wasn't even formalised until 20 years later in 1981 [0]
[0] https://en.wikipedia.org/wiki/Fourth-generation_programming_...
There are organizations which dug themselves into the COBOL hole. What are they doing to get people to learn the skills necessary to deal with the next crisis?
https://www.microfocus.com/en-us/products/visual-cobol/overv...
https://www.fujitsu.com/global/products/software/developer-t...
Who knows, that cool Kubernetes microservice deployed on Amazon might have been written in Cobol,
https://www.microfocus.com/media/success-story/trasmediterra...
https://www.openmainframeproject.org/projects/coboltrainingc...
You'll have tons of eager applicants claiming to have years COBOL experience at your door in no time.