Was this helpful?
User-Defined Data Handlers for Large Objects
Note:  User-defined data handlers for large objects are not supported in MFCOBOL on UNIX.
You can use user-defined data handlers to transmit large object column values to or from the database a segment at a time. For more details on Large Objects, the datahandler clause, the get data statement and the put data statement, see the SQL Reference Guide and the Forms-based Application Development Tools User Guide.
ESQL/COBOL Usage Notes
When using ESQL/COBOL, the following notes apply:
The datahandler, and the datahandler argument, should not be declared in an ESQL declare section. Therefore, do not use a colon before the datahandler or its argument.
You must ensure that the datahandler argument is a valid COBOL record. ESQL will not do any syntax or datatype checking of the argument.
The datahandler must be declared to return an integer. However, the actual return value will be ignored.
Data Handlers and the SQLDA
You may specify a user‑defined data handler as an SQLVAR element of the SQLDA, to transmit large objects to/from the database. The eqsqlda.h file included using the include sqlda statement declares one IISQLHDLR record which may be used to specify one data handler and its argument. It is defined:
* Declare IISQLHDLR
        01 IISQLHDLR EXTERNAL.
           05 SQLARG   USAGE POINTER.
           05 SQLHDLR  PIC S9(9) USAGE COMP.
You can also code this record directly, instead of using the include sqlda statement. You can choose any name for the structure and you can declare more than one in a single program. The program must set the values:
* Declare the argument to be passed to datahandler
     01 HDLR-ARG.
            05  ARG-CHAR   PIC X(100).
            05  ARG-INT    PIC S9(9) USAGE COMP.

* Declare the datahandler
     01 GET-HANDLER PIC S9(9) USAGE COMP VALUE
             EXTERNAL GET-HANDLER.

* Set the IISQLHDLR values for SQLHDLR and SQLARG
     MOVE GET-HANDLER TO SQLHDLR.
     SET SQLARG TO REFERENCE HDLR-ARG.
The sqltype and sqllen fields of the SQLVAR element of the SQLDA should then be set as follows:
MOVE 46 TO SQLTYPE(COL).
MOVE  0 TO SQLLEN(COL).
Last modified date: 01/30/2023