0
votes

What is the use of handles in progress? Should it be used as a data type or is it an object? Please explain the usage of handles with buffers.

I have come across the following set of lines with handle and buffer:

ON WRITE OF customer NEW BUFFER new_in OLD BUFFER old_in 
do:
    DEFINE VARIABLE m_obuf_hdl AS HANDLE  NO-UNDO.
    DEFINE VARIABLE m_nbuf_hdl AS HANDLE  NO-UNDO.

    ASSIGN m_obuf_hdl = BUFFER old_in:HANDLE 
           m_nbuf_hdl = BUFFER new_in:HANDLE.
end.
1
This is a very generic question. And showing a few more lines of the code would make it easier to explain it based on your example. - Mike Fechner
You should describe your actual problem! - Jensd

1 Answers

4
votes

HANDLE is an ABL data-type. The purpose of a HANDLE is to be the reference (pointer) to an built in object type, like the Buffer in your code. You will find the methods and properties of the buffer under the "Buffer object handle" section in the ABL documentation. This sample loops through all fields of the buffer (your buffer old_in) and outputs all fields:

DEFINE VARIABLE i      AS INTEGER NO-UNDO . 
DEFINE VARIABLE hField AS HANDLE NO-UNDO .

DO i = 1 TO m_obuf_hdl:NUM-FIELDS:
    ASSIGN hField = m_obuf_hdl:BUFFER-FIELD (i).
    MESSAGE hField:NAME hField:BUFFER-VALUE.
END.