6 ms·
One of my last jobs as an intern in 2004 was to rewrite an old batch process COBOL app in C# and ASP.Net. App was basically input about 6 fields, and based up s
by hermitdev 7y ago
One of my last jobs as an intern in 2004 was to rewrite an old batch process COBOL app in C# and ASP.Net. App was basically input about 6 fields, and based up some rules. It really wasn't terribly complicated, but I had to read the source to understand exactly what it did. It was also my real exposure to COBOL. Took me a while to realize that around 60 printed pages of the 80ish page program was nothing but hard coded data tables and rules, when this, then that, etc. Once I realized that, it was a few simple regexs to pull that and transform to xml (was early 2000s...).
While decyphering the remaining logic, I discovered what I think is the most evil programming construct I've so far seen; think goto is bad? Meet MOVE NEXT SENTENCE. COBOL is traditionally written in all uppercase (and historically EBCIDIC). So what does "MOVE NEXT SENTENCE" do? It's an unconditional jump to the next period, that's right '.'. Thats right, in a language where everything looks like it's yelling at you, you have to find a little tiny period to find where execution resumes. No labels, just a tiny couple of pixel round period. Fun...
- icxa 7y ago> you have to find a little tiny period to find where execution resumes. No labels, just a tiny couple of pixel round period. Totally naive to COBOL here, why do you have to do it? You said you wrote some regexes for the pull and transform, why not pipe the source to a program that finds that period for you?
- nexuist 7y agoI don't think it would have been a hassle for him specifically (could always just ctrl/cmd + f....), he's moreso lamenting the fact that this is an actual feature i.e., if you actually wanted to program in COBOL for some reason you'd actually have to deal with this, which makes its inclusion insane.
- hermitdev 7y agoYeah, it wasn't an issue of doing CTRL-F, it was about making sense of that flow when the control jumps you multiple screens of code. The problem isn't finding the destination, its what alternately happened been source and destination. Also, if your reading on paper, CTRL-F isn't available. You're scanning those pages by hand. When you're sitting there, highlighter and pen in hand to make annotations and point out important shit, its a problem. End up with circles around the periods and arrows point to it with comments like "this is how we got to x from y." Edit: also if you end up at the same place regardless of the source or from multiple sources. You can't keep the code for a level to find everywhere a jump emds up there.
- golergka 7y agoOr even a simple script that would convert source code from all-caps to the usual normal-language sentences and then back.
- dmurray 7y agoLike a different font?
- HeWhoLurksLate 7y agoLike "sentence".capitalize() In Python.
- hermitdev 7y agoIn 2003, when I went through this headache, I wasn't even aware of Python. Might have barely made 2.0 at that time.
- BjoernKW 7y agoCOBOL programs reside on mainframe computers, an environment that's entirely alien to someone who's used to UNIX-like environments where you have something like a pipe. I'm not sure how and on which machines COBOL code is written and compiled these days but I reckon that piping it to grep, or similar tools, might simply not be an option on those machines.
- lboc 7y agoFYI on IBM mainframes, MVS has included an integrated Unix environment since 1993 [0]. This continues to be developed and supplied with the latest versions of z/OS :) Here's someone asking about doing just that: https://serverfault.com/questions/356574/can-i-run-grep-against-a-zos-dataset-via-unix-system-services https://serverfault.com/questions/356574/can-i-run-grep-agai... [0] https://en.wikipedia.org/wiki/MVS#MVS/XA https://en.wikipedia.org/wiki/MVS#MVS/XA (Edited to go back even further than OS/390)
- pulse7 7y agoToday they write/edit COBOL programs in IBM WebSphere Studio Application Developer (today named IBM Rational Application Developer for WebSphere Software) which is a commercial version of Eclipse with several mainframe related plugins. So they use usual Eclipse editors with remotely located files and they can find these periods without grep - just with CTRL+F...
- drabiega 7y agoMy experience was that while the IDE was available and picked up by newer developers, the majority of developers at the mainframe shop where I worked avoided it as much as possible for pretty much the same reasons seasoned UNIX devs prefer working via command line and text editor.
- tyingq 7y agoA pretty good account of a "new to mainframes" person figuring out how to make their first Cobol program on z/OS: https://medium.com/@bellmar/hello-world-on-z-os-a0ef31c1e87f https://medium.com/@bellmar/hello-world-on-z-os-a0ef31c1e87f
- tjalfi 7y agoCOBOL has a worse construct than this. ALTER LABEL1 TO PROCEED TO LABEL2 This will cause any gotos to LABEL1 to be redirected to LABEL2. This is worse than older Fortran's arithmetic IF[0]. [0] https://en.wikipedia.org/wiki/Arithmetic_IF https://en.wikipedia.org/wiki/Arithmetic_IF
- quickthrower2 7y agoMetaprogramming. Nice.
- Annatar 7y agoIt's self-modifying code, which is not the same thing as metaprogramming, which utilizes unexpanded expressions (often macros) which then get expanded in the final evaluation.
- vidarh 7y agoThe term meta programming in languages like Ruby and many others tends to be taken to include the language ability to dynamically alias (or create) methods at runtime. I don't think I can remember having seen it used to mean something as restrictive as you suggest
- jazzyjackson 7y agoI am much happier knowing this thank you
- raverbashing 7y agoHappy as in happy to never need to touch something like that
- jazzyjackson 7y agoYes it just fills me with appreciation for what I've taken for granted (although working in javascript of course any function can get redefined at any time so some things never change)
- Smoosh 7y agoI don't think it is "MOVE NEXT SENTENCE". The NEXT SENTENCE clause is part of an IF statement. COBOL is usually coded with every statement a sentence, terminated with a period. The exception is nested statements (such as IF statements), where you don't apply a period inside the nesting. The NEXT SENTENCE clause is used to exit the nested logic and continue at the next statement after the period. Of course, your point stands, and this has been a long standing issue for COBOL, especially since a missing or extra period is probably still syntactically correct. I just finished refactoring a couple of COBOL programs to remove all of the periods from PD code - which is how I prefer it. Can't wait to see how it goes at code review! https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rlpsif.htm https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/...
- flomo 7y agoSure, Dijkstra said BASIC ruins you, but this is actually a nice incremental improvement over what your 1980s home computer had to offer.
- enriquto 7y ago> While decyphering the remaining logic, I discovered what I think is the most evil programming construct I've so far seen; Wait, you never heard about exceptions?
- Haga 7y agoJava gotos
- pgeorgi 7y ago> Thats right, in a language where everything looks like it's yelling at you, you have to find a little tiny period to find where execution resumes. In old non-proportional fonts on old CRT screens with low resolution, "." was a pretty noticable glyph. Typewriters tend to have rather noticable periods, too. That convention truly was a child of its time.
- darkwater 7y agoI know that refers to an even earlier period but... it is funny how in telegrams (real telegrams, not the chat application) the period was replaced by the STOP word because it could be often misprinted, because it was really tiny and a printing artifact could be read as a period. So I think what you said it's true: conventions are indeed children of their times.