Once you have initialized a MEMPTR variable, you can build a data aggregate (structure) or access an existing structure in the associated memory region using several memory-writing statements and memory-reading functions. Memory-writing statements write values to specified locations in the memory region. Memory-reading functions return values from the specified locations in the memory region. Through an appropriate choice of these statements and functions you can thus copy ABL data types and bit fields to and from MEMPTR variables. You can also copy complete OpenEdge database records to and from MEMPTR variables.
Note: Before setting or getting values in a MEMPTR variable, you might want to check the MEMPTR size using the GET-SIZE function. For more information, see Initializing and uninitializing MEMPTR variables.
This is the syntax for the MEMPTR memory-writing statements (except PUT-STRING):
This is the syntax for the MEMPTR memory-reading functions (except GET-STRING and GET-BYTES):
Syntax
GET-datatype ( mptr-name , byte-position )
Each PUT-datatype statement writes a value (expression) of a certain data type to the memory region associated with the MEMPTR variable mptr-name at the specified byte-position. Each GET-datatype function reads and returns the value of a data type from the memory region associated with the MEMPTR variable mptr-name at the specified byte-position. The byte-position in these statements and functions is specified by an integer expression that starts at one (1).
The PUT-STRING statement and GET-STRING function each allow an additional optional parameter that specifies the number of bytes to write or read in the MEMPTR variable. The GET BYTES function has the same parameter, but it is required for this function.
Note: The mptr-name parameter in these statements and functions can reference RAW as well as MEMPTR variables. However, the EPIs that require MEMPTR variables cannot use RAW variables directly. You must convert RAW values to MEMPTR before using them with these EPIs. You can do this using direct assignment between RAW and MEMPTR variables or by using statements and functions such as PUT-BYTES, GET-BYTES, or GET-RAW.