On Thu, 13 Mar 2008 13:54:21 GMT, "Michael Mattias"
<mmattias@[EMAIL PROTECTED]
> wrote:
>In the grand scheme of things, does it really matter if ODOs are
allocated
>dynamically or statically?
Yes. There would be no problem is every program were a single monolithic
blob of Cobol.
When you let one program call another, there are problems with
addressability. Say A calls
B, B calls C, C changes the structure size and exits. B's parameter is no
longer valid. A,
which owns the structure, no longer knows where it is either.
You could have every data reference call a memory manager to get the
structure's current
address. That would kill performance. You might as well write in Java.
The practical solution would be to require every ODO to be BASED, and have
every CALL pass
a pointer to the BASE pointer. That's fine for Cobol, but you couldn't
pass nor receive
ODO structures to/from other languages, because they're not expecting a
double pointer.
The same would go for ANY LENGTH data items declared or implicitly
INDIRECT, which would
have to be implemented with hidden BASE pointers. Note that *all* ANY
LENGTH data items
not at level 1 are INDIRECT.
For example, a simple ASCIIZ string:
05 s-source pic x any length delimited by low-value.
05 s-destination pic x any length delimited by low-value.
call 'strcat' using s-destination, s-source
is not going to work, because Cobol will pass the addresses of base
pointers, not the
addresses of strings.
>Seems to me as long as there are "n" occurences available where
n=current
>value of DEPENDING ON variable, the applications programmer doesn't care
a
>hoot about the allocation strategy employed by the publisher.
Now, he can touch n+1 without getting a memory protection error. For
example, he sloppily
populates n+1 BEFORE incrementing the DO. If allocation were dynamic, the
program would
abort.
>True, that publisher's strategy may - and perhaps should - figure into
your
>evaluation of "which" COBOL compiler to use, but once that decision has
been
>made it's immaterial.
Speed is not the only issue. Dynamic allocation would cause many language
standards
issues. So long as the Cobol standard avoids dealing with implementation
details, dynamic
allocation is not feasible. Not without losing compatibility with other
languages and the
OS API.


|