On Sun, 29 Apr 2012 16:22:48 +0200 (CEST), Nomen Nescio
<[email protected]> wrote:

>> much snipped
>
>Newsgroups: bit.listserv.ibm-main,comp.lang.cobol
>Subject: Re: GO TO "cobol"
>References: <[email protected]>
>Message-ID: <[email protected]>
>Date: Thu, 19 Apr 2012 11:42:24 +0200 (CEST)
>
><snip> I wrote
>
>COBOL doesn't inline PERFORM. A coder can choose to code an inline PERFORM,
>so there is a good example of one thing the coder can do better in source
>than the compiler.

If PERFORM READ-RECORD performs a paragraph that CAN NOT be reached
via GO TO or a fall through from the previous paragraph AND there is
no GO TO or GOBACK / STOP RUN / EXIT PROGRAM in the paragraph AND the
OPTIMIZE option is chosen on any IBM 370 / 390 / z series compiler
starting with VS COBOL II V1R4, the code may well be inlined (moved
out of sequence).   I have verified this by reading the procedure
division map produced by the compiler.  There have been SHARE
presentations given by Tom Ross of IBM COBOL development in Santa
Teresa stating this and noting that a paragraph may be copied to more
than one place.

Based on my reading of the generated code back in the 1990s I changed
my code to ONLY use PERFORM and NEVER PERFORM ... THRU on new
programs.  This change in how things worked also allowed me to
simplify nested IF ... END-IF statements by moving appropriate nesting
levels to a separate paragraph with no loss of efficiency because the
compiler moved the statements back in line.  

Another optimization that came in at the same time was recognizing
that an offset related to a subscript had been calculated and using
that offset for subsequent subscripted references thus eliminating the
value of moving entries to a work area.

Any time you get a new version of a compiler in any language, read the
manual to see what coding changes would be beneficial and what
compiler options can work in your environment.  Some techniques that
were valuable with the COBOL VS (1974 standard) and saved time using
the right OPTIMIZE options became counter productive with VS COBOL II
V1R4.  

Clark Morris 
>
><snip> I wrote
>
>         PERFORM READ-RECORD.
>         PERFORM SOMETHING ELSE.
>
>
>
>
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to