"Shared" procedure division code
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Jul 2005 22:23:48 GMT
As a follow up on another thread ....
It seems to me that the most common place where I *used* to see the same source
code (paragraph/section) repeated within a single program was in OLDER (IBM)
CICS code where "locality of code" was an issue. That was that it was important
that the application not need to "page in and out" sections of machine code
depending upon application logic flow. Although this is still a MINOR
consideration in that (and possibly other) environments, I don't know where it
happens with NEW code today. However, in that older code, it was (medium)
common to see the same (differently named) paragraph/section "near" multiple
places in the program logic where it could be needed.
This was also one of the few places that I have ever seen (again infrequent -
but occasionally) COPY statements within a paragraph, e.g. (CAPS and '74
Standard code)
PARA1.
IF XYZ
PERFORM PARA2
ELSE
PERFORM PARA3
.
PERFORM PARA4
PERFORM WINDUP
.
PARA2.
lots of logic here
IF XXX
PERFORM PARA5-1
.
more logic
.
PARA5-1.
COPY P5LOGIC.
.
PARA3.
some logic - more than "one page" of memory required
.
PARA4.
lots of logic here
IF XXX
PERFORM PARA5-2
.
more logic
.
PARA5-2
COPY P5LOGIC.
.
***
With this "copy in procedure division" approach one could "physically" store
common source code in a single place - but also have "locality of code" for the
generated machine code.
I neither recommend this approach nor (personally) know of any reason to use it
in today's computing environment, but did think it was worth mentioning (both
for the "use of duplicated code" and the solution to "maintenance of such code")
--
Bill Klein
wmklein <at> ix.netcom.com
.
- Follow-Ups:
- Re: "Shared" procedure division code
- From: Pete Dashwood
- Re: "Shared" procedure division code
- From: Caederus
- Re: "Shared" procedure division code
- From: Caederus
- Re: "Shared" procedure division code
- From: HeyBub
- Re: "Shared" procedure division code
- From: Oliver Wong
- Re: "Shared" procedure division code
- Prev by Date: Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
- Next by Date: Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
- Previous by thread: Re: COBOL FAQ
- Next by thread: Re: "Shared" procedure division code
- Index(es):