Reading and writing data
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Reading and writing data
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.
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):
Syntax
|
This is the syntax for the MEMPTR memory-reading functions
(except GET-STRING and GET-BYTES):
Syntax
|
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.
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.