[Default] On 7 Jun 2020 03:33:44 -0700, in bit.listserv.ibm-main sme...@gmu.edu (Seymour J Metz) wrote:
>I generally get by with control structures like case (select/when), >if/elsif/when, iterate and leave, but I unashamedly use GOTO, when it is the >cleanest way to do something; I refuse to avoid a useful construct just >because it is not politically correct. In the case of COBOL, I consider the >out of line PERFORM to be far more dangerous. I have a similar issue with >REXX; it does not have lexical scope, and you can fall into a procedure. With any supported IBM COBOL, it can and should be written such that there are no fall throughs and without PERFORM ... THRU ... statements. By use of only PERFORM statements (without THRU) code movement is possible such that PERFORMED paragraphs can be moved inline which can be important in this era of cache and instruction look ahead. In order to maintain the ability for the compiler to do code optimizing I have coded PERFORMs of catastrophe paragraphs which have terminating STOP RUN, GOBACK or calls to an ABEND routine. Code which was optimal under OS/VS COBOL (1974 standard) became poor under VS COBOL 2.4 and later (1985 standard and later). As someone who coded programs ALTER xxx TO yyy instead of PERFORM to save 16 bytes in order to fit into a 16K DOS 360 background partition or 6K DOS 360 foreground partition, this represents a drastic change in philosophy. In the late 1980s I drastically rewrote a program to substantially reduce both CPU and run time in the late 1980s or early 1990s in the OS/VS COBOL available to me. ALL PERFORM xxx VARYING statements were eliminated and PERFORM xxx THRU xxx-EXIT statements were used where GO TO xxx and GO TO xxx-EXIT statements were used to do the iteration of the loop and the exiting of the loop. I submitted an article to the NAASPA magazine (the name escapes me at the moment) regarding all of the optimizations which was published. I did put in the caveat that the VS COBOL II compiler would make some of those optimizations counter-productive. Indeed to accomplish the same goal the rewrite would have had to have been substantially different for VS COBOL 2.4 and later. Clark Morris ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN