Access ABL data
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
This section describes how to use HLC library functions to access ABL data. For example, you
can use the prordbi() function to read an integer field in a shared buffer.
Use the following guidelines when accessing ABL data with HLC library functions:
- Use correct data types for the parameters you pass to HLC library functions — In general, C compilers do not verify whether the data types of the parameters you provide in a function call agree with the parameter data type definitions specified in the function declaration.
-
Use correct values for the parameters you pass to HLC library functions —
For example, HLC functions that access ABL shared buffers use the fhandle parameter.
The fhandle parameter has the
INTEGERdata type. You must set fhandle correctly to read from or write to the correct location in the buffer. - Use pointer variables properly — Many HLC library functions that access ABL use pointer variable parameters. Improper use of pointer variables can cause you to overwrite random locations in memory, with potentially hazardous results.
The following example demonstrates these guidelines by defining
shared buffer custbuf within an ABL procedure:
|
Later in your ABL code, execute a CALL statement
that calls a C function. Within the C function, you read the custnum
field. The custnum field is an integer field in the customer table,
for which shared buffer hlcbuff is defined. For example:
|
The prordbi() function reads an integer field contained in a shared buffer.
To determine the HLC library function to use, see the function summary in HLC Library Function Reference.
This is the syntax for the prordbi() function:
Syntax
|
The pbufnam parameter points to the name of the specified shared buffer. You supply the name from your OpenEdge application.
The fhandle input parameter is the field handle that
profldix() returns for the specified field.
The index input parameter specifies an index value for an array field. If the field is a scalar, you must set the value of index to 0.
The pvar output parameter points to a long where
prordbi() returns the value of the specified integer field.
The punknown output parameter points to an integer where
prordbi() returns 1 if the field has the Unknown value
(?), and returns 0 otherwise.
The following figure shows a call being made to prordbi() that illustrates
HLC programming guidelines.
