LOCNEWSPACE

The LOCNEWSPACE(x, a) built-in subroutine allocates space in a for the variable type described by the LOCATES attribute that is associated with x.

Read syntax diagramSkip visual syntax diagram
>>-LOCNEWSPACE(x,-+---+-)--------------------------------------><
                  '-a-'     

x
Must be an OFFSET reference with the LOCATES attribute. x must be scalar.
a
Must be an AREA reference. a must be scalar.

If you do not specify a, the OFFSET attribute for x must have specified an AREA reference, and LOCNEWSPACE allocates space in that area.

In the following code snippet, the two executable statements are equivalent: Both statements allocate 32 bytes from the pool area and assign that offset to name(1).
	      declare
              1 data based(data_ptr) unaligned,
                 2 actual_count fixed bin(31),
                 2 orderinfo(order_count refer( actual_count)),
                    3 name    offset(pool) locates(char(30) varying),
                    3 address offset(pool) locates(char(62) varying),
                 2 pool area(10_000);
         
       call locnewspace(name(1)); 
       call locnewspace(name(1), pool); 





Published: 23 December 2018