4 ms·
I had to deal with a bunch of mainframes in a previous job and tried to learn a bit of COBOL. One interesting thing I learned early on was that programs are alm
by giaour 3y ago
I had to deal with a bunch of mainframes in a previous job and tried to learn a bit of COBOL. One interesting thing I learned early on was that programs are almost never written exclusively in COBOL. The language isn't Turing complete (by design), so a significant portion of a program's logic will be captured in the JCL (Job Control Language) script that configures how the program will run and orchestrates multiple programs.
- tyingq 3y agoI'm with you on the idea that mainframe COBOL is typically only part of the actual program. But COBOL not being Turing complete sounds...not right.
- tgv 3y agoI'm fairly sure it is. You can literally write to tape.
- giaour 3y agoI'm not using the formal definition here -- I meant that there are programs you can write in other mainstream programming languages that just can't be expressed in COBOL due to limitations on recursion. The COBOL spec doesn't allow recursive "paragraphs" (functions), though some implementations support it. (This may no longer be the case, or this limitation may have been specific to the language version used at my job.) The main limitation is I/O, though. You typically use JCL to indicate what files/DBs a program will run against, and I recall that everything that touched the network was written in Java and called from JCL (whether this was because networking libraries don't exist in COBOl or because those that do are terrible, I couldn't say).
- paulddraper 3y agoRecursion is not necessary for Turning completeness. Recursion and loops are interchangeable.
- araes 3y agoIt was somewhat dependent on your job, although the norm is no recursion. From Wikipedia "other compilers, like IBM COBOL, will produce code that prints "1 2 3 END END END END ..." and so on, printing "END" over and over in an endless loop." [1] Also, having never used COBOL, the PERFORM statement is pretty cool. Like calling arbitrary parts of a Switch statement with a single line. Would be neat if some other languages had that. [1] https://en.wikipedia.org/wiki/COBOL#Procedures https://en.wikipedia.org/wiki/COBOL#Procedures
- MarcusE1W 3y agoYou can use recursion in COBOL, you just have to write your own stack first. But I agree, it’s definitely more limited than other languages.
- theodpHN 3y agoWhile much-maligned, what JCL (and software like CLISTs and REXX for interactive processing) brings to the table in the mainframe world is a STANDARD way for programmers to not only decouple code and the data resources the code will process, but also a wealth of other functionality, including job accounting, priority, job classes, network routing of jobs & resources, conditional execution, run-time library management, resource caps, output management, catalog management & file disposition, real temporary files, file versioning (GDGs), storage & device management including tape, procedures, includes, symbolic variables, checkpoint restarts, etc.). In non-mainframe realms, while the good news is that there's no JCL, the bad news is that individuals and companies have pretty much reinvented the JCL wheel over and over again, creating their own hodgepodge of unique, non-standard efforts to deliver smidgeons of similar functionality hacked together from a mix of shell scripting, environment variables, YAML, JSON, other config files, manual prompting, third-party libraries and software, and even hard-coding resources in programs. Grass is always greener, as they say. :-) https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sa231386?OpenDocument https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pag...
- Kiro 3y agoWhat is COBOL missing that makes it not Turing complete?