Previous Next

SET-SIZE statement
Manages memory associated with a MEMPTR variable. This includes allocating and associating a region of memory with an uninitialized MEMPTR variable, setting the size of a region allocated with a Windows dynamic link library (DLL) or UNIX shared library routine for a MEMPTR, and deallocating memory associated with a MEMPTR variable.
Note:
Syntax 
 
SET-SIZE ( memptr-var ) = size 
memptr-var
A reference to a variable defined as MEMPTR.
size
An integer expression that specifies the allocated byte size of the region pointed to by memptr-var.
Example 
In the following example, the SET-SIZE statement allocates 8 bytes of memory, associates the memory with the ElipRegion variable, and then initializes the region with four SHORT (2-byte) values:
 
DEFINE VARIABLE ElipRegion AS MEMPTR NO-UNDO.
 
ASSIGN
  SET-SIZE(ElipRegion)     = 8
  PUT-SHORT(ElipRegion, 1) = 10
  PUT-SHORT(ElipRegion, 3) = 10
  PUT-SHORT(ElipRegion, 5) = 200
  PUT-SHORT(ElipRegion, 7) = 50.
Notes 
*
If memptr-var has no memory allocated to it (is uninitialized), then the SET-SIZE statement allocates a memory region of the specified size.
*
Caution:
*
*
If the specified size is greater than 0 and memptr-var is fully initialized (associated with a memory region of a specified size), the SET-SIZE statement has no effect and leaves memptr-var unchanged.
*
*
For more information on accessing DLL routines from ABL, see OpenEdge Development: Programming Interfaces.
See also 
GET-POINTER-VALUE function, GET-SIZE function

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.