Re: Dynamic memory in standard COBOL; using large data fields



Slight correction or clarification to Chuck's post.

The '02 Standard *does* introduce the ALLOCATE and FREE statements to do what
you are calling "getmain" and "freemain" (IBM mainframe terminology - I don't
know how common this is). It also includes POINTER data items and based data.

What the (currently under development) '08 Standard will introduce is "dynamic
capacity tables" (and any-length items). The former will provide a method for a
new type of OCCURS where a table will "grow" and/or shrink - along with the
storage it uses.

--
Bill Klein
wmklein <at> ix.netcom.com
"Chuck Stevens" <charles.stevens@xxxxxxxxxx> wrote in message
news:d7i4em$22fo$1@xxxxxxxxxxxxxxxxxxxxxxx
>
> "clvrmnky" <clvrmnky-uunet@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:aR%me.8324$5u4.27086@xxxxxxxxxxxxxxxxx
>> My review of available literature seems to indicate that COBOL-85 does
>> not support the notion of dynamic memory. That is, there is no standard
>> malloc or calloc style keywords or calls I can make to allocate and grow
>> a hunk of memory for an application.
>
> Indeed, ANSI X3.23-1985 provides neither standard syntax nor standard
> functions to provide this capability. Nor does ISO/IEC 1989:2002.
>
> The COBOL standard being developed for approval in 2008 includes in the
> current draft both "any-length elementary items" and "dynamic-capacity
> tables", alone or in combination. This isn't so much based on the C or
> Pascal models of the "heap" as it is oriented toward adding true
> variable-length capabilities to existing COBOL applications.
>
> -Chuck Stevens
>
>


.



Relevant Pages

  • Re: which is the better way to declare dynamic single dimension array inside struct
    ... > This, AFAICT, is not UB; you can allocate whatever size you want. ... The compiler doesn't define UB, the standard does. ... > The problem isn't with malloc or with pointer arithmetic; ...
    (comp.lang.c)
  • Re: Derived types and allocatable
    ... standard as of 2003. ... array assignment behaved differently depending on whether the array ... responsibility of the programmer to allocate the target explicitly if ... No standard conforming F95 program should behave any differently ...
    (comp.lang.fortran)
  • Re: (part 10) More Schildt-like errors in Dicky Heathens book
    ... The standard connects malloc() to realloc() only ... if reallocdidn't actually try to allocate a new chunk. ...
    (comp.lang.c)
  • Re: static allocation question...
    ... In a conforming C program -- that is, one that obeys the rules of ... If it is impossible to write such code, *any* C compiler is free ... not allocate it) at any time. ... generating code that does what that standard requires. ...
    (comp.lang.c)
  • Re: Freeing memory - will it be available immediately
    ... In fact the standard has nothing to say about when it is freed ... returns the memory to the OS, i.e., shrinks the data segment of the ... unsigned char *ptr; ... Attempting to allocate 1000000000 bytes... ...
    (comp.lang.c)