[Default] On 13 Jul 2016 23:28:47 -0700, in bit.listserv.ibm-main bill.wood...@gmail.com (Bill Woodger) wrote:
>Why has ALTER always been bad? Because of the potential scope of things that >you can do with it, or because COBOL programmers will ignore or be unaware of >any "best practice" for using it, or something else? If either of the first >two, then away goes "EXIT PARAGRAPH/SECTION" into the bad-boys-bucket. When I was implementing the payroll programs for our 32K 360/30 with a 16K (NOT M) background partition and a 6K foreground partition for print programs, I made extensive use of ALTER because the COBOL D compiler generated for PERFORM MVC (save current branch address of exit), MVC (set address of exit to return, B (branch to paragraph header), MVC (restore previous address of exit). The exit was just a B (branch to next paragraph) By using ALTER I was able to set up a pseudo PERFORM that was just MVC (set switch functioning as an exit to go to chosen location, normally a new paragraph immediately following the ALTER GO TO combination) B (branch to paragraph preceding switch) where the switch was just a B (initially set to following paragraph). All switch paragraph names were preceded by the letters SW and all had notes telling where set and to what paragraph. The saving of 12 bytes per perform was significant in this environment. Other arcane measures were taken. The expansion of the mod 30 to 64K giving 2 partitions of 22K and use of ASAP for spooling reduced the need for such drastic measures and they were not taken for programs written in the 1970s. Some were rewritten to conform to structured guidelines and reduce the number of minefields for subsequent programmers. From a performance point of view, these measures became counter productive with VS COBOL v1.4 - the 1985 standard with optimizations such as code movement where PERFORMed paragraphs were copied to replace the PERFORM if there were no GO TO statements in the paragraph and the PERFORM was not a PERFORM THRU. While there are concerns with the enhanced EXIT statements, they provide a less convoluted way of breaking out of a loop without requiring a GO TO statement. This in turn allows better compiled code optimization. In a world where a 1+ gigabyte address space size is being superceded by address space sizes greater than the entire data capacity of moderate size data centers of 30 years ago, many techniques that once made sense and were worth the confusion just are completely counter-productive. Clark Morris PS. Is there anyone on this list who had the misfortune of inheriting some of my payroll and marketing programs that used ALTER? > >If the last, please elucidate, but remembering the context of the time. Bear >in mind also that it was likely not invented out of thin air for COBOL, so >likely "best practice" in programming at the time of COBOL's development. > >I'm not suggesting the use of ALTER (that would be regarded like suggesting >that faeces are added to your breakfast cereal), or even GO TO ... DEPENDING >ON ..., or even GO TO, or NEXT SENTENCE, or the new EXIT formats. > >I am suggesting the historic record and current observable practice seem to >indicate that the new EXIT formats will be (ab)used and new forms of minor >chaos will ensue. > >At that point, I'm not going to sit back and tell you "I told you so". I'm >telling you now :-) > >We can attempt to ameliorate with "best practice for the use of new forms of >EXIT (if you really feel you must use them)". > >To me, "structured programming" is not limited by the availability of language >constructs for "structure". For too many, present company excluded until known >otherwise, simple using structured constructs does not make a program >"structured". > >"Here's EXIT PERFORM, that looks like a construct in another language that is >regarded as an aid to structured programming, so I'll use it, then my program >will be structured". Similar to "But my program works, it uses INITIALIZE >[when of course it doesn't, and the INITALIZEs are all of fields whose >contents are replaced by the next line of code]", or "I got a clean compile >but somehow my program doesn't work". > >Of course, anyone can say anything bad they like about ALTER, and get away >with it, as it is hated. Same with COBOL. As well as "external myth" there's >self-generated internal myth (like S0C1 for reading a file which is not open, >and many, many others). > >On Thursday, 14 July 2016 06:35:39 UTC+2, Edward Gould wrote: >> > SNIP------------------------------------ >> > ALTER is bad because its not obvious when you look at a piece of code >> > where it might actually branch to. >> > >> >> >> Alter has *ALWAYS* been bad. >> >> Ed > >---------------------------------------------------------------------- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN