3 ms·
Two-column proofs I had never heard of that monstrosity before and having googled it, it looks worse than programming in COBOL.
by anon4 11y ago
Two-column proofs
I had never heard of that monstrosity before and having googled it, it looks worse than programming in COBOL.
- YeGoblynQueenne 11y agoProgramming in COBOL is vastly underrated. If you're not speaking from experience, Google "working storage" (one of COBOL's nicest features) . Also: it runs on machines that look like Cylons. You can't beat that. :p
- derefr 11y agoI can't quite figure WORKING-STORAGE out from the docs I found, maybe because I'm not sure what a "run unit" is—I'm assuming something like a Linux process group/session? To contrast, LOCAL-STORAGE seems like a regular global variable (.DATA/.BSS) segment. So is WORKING-STORAGE basically like a set of seeming global variables, that actually point into (the equivalent of) a shared mmap'ed file, such that other processes in the same session/pgroup end up mmap'ing the same file and thus sharing memory that way, without having to clone around the memory handle itself via forking/threading/IPC? In this case, it sort of reminds me of the OS-level version of an anonymous Erlang ETS table held by a supervisor and passed to all the worker children to manipulate.
- YeGoblynQueenne 11y agoAh, nothing that complicated :) It's a data structure with named fields. Each field can be a different type and they are in specific positions in the data structure so that it forms a pattern with strongly typed components. COBOL's type definitions are also patterns really - for instance you declare a field to be of type 9(7) which means a numeric field of length 7 and so on. The whole setup gives you very fine control over the structure of your data. For example, you can describe lines of a document to be printed out with strongly typed fields to be filled in by your program, so a form basically. It's also used as a template for documents like VSAM files. Those are flat-file databases and the COBOL program's working storage imposes structure on them. Here's a small example: 01 FILE-RECORD. __03 WS-ACCOUNT_____PIC 9(10). __03 WS-SEPARATOR1__PIC X. __03 WS-NAME________PIC S(25). __03 WS-SEPARATOR2__PIC X. [Underscores are formatting only, not COBOL syntax] That declares a structure called FILE-RECORD with four named fields, one of numeric type with length 10, one of alphabetic type with length 25 and two of alphanumeric type with length 1. So that's one record in your file structure and you can fill it in with data from VSAM files and the like, then print it out, with the separator fields for formatting. It's a strange thing, low-level and high-level at the same time, in a very nice way. It kind of grows on you. Well, it's grown on me anyway. Of course, YMMMV. Btw, the numbers (01, 03) make the hierarchical relation between the root of the data structure and each of its fields explicit; I won't say I'm in love with that sort of syntax :) Also, I'm a total no0b still, so I might have made some mistake above, apologies in advance if that is the case.
- j2kun 11y agoThen be thankful you weren't subjected to a full year of two-column proofs as your daily routine.