SQL/MP Programming Manual for COBOL

SQL/MP System Procedures
HP NonStop SQL/MP Programming Manual for COBOL529758-003
5-23
SQLCAGETINFOLIST
Example 5-3. Calling the SQLCAGETINFOLIST procedure (page 1 of 2)
WORKING-STORAGE SECTION.
...
* Declare a buffer to hold the error information:
01 ERRORS-AND-WARNINGS.
02 NAME-LEN PIC S9(4) COMP.
02 NUM-ERRS PIC S9(4) COMP.
02 NAME PIC X(32).
02 ERR-CODE PIC S9(4) COMP.
* Include the SQLCA declaration:
EXEC SQL INCLUDE SQLCA END-EXEC.
* Declare a variable to hold the size of the buffer, to
* be calculated using INSPECT..TALLYING:
01 ERR-WARN-SIZE PIC S9(4) COMP.
* Declare a variable to hold the return code for the call:
01 CALL-ERROR PIC S9(4) COMP.
* Declare the item-list table:
01 ITEM-LIST.
02 ITEMS PIC S9(4) COMP OCCURS 4 TIMES.
01 ERROR-ITEM PIC S9(4) COMP.
PROCEDURE DIVISION.
* Initialize the item-list table:
* Code for actual name length:
MOVE 7 TO ITEMS(1).
* Code for actual number of errors or warnings:
MOVE 3 TO ITEMS(2).
* Code for procedure name:
MOVE 8 TO ITEMS(3).
* Code for error number:
MOVE 22 TO ITEMS(4).
* Calculate the size of the buffer for passing to
* SQLCAGETINFOLIST:
INSPECT ERRORS-AND-WARNINGS
TALLYING ERR-WARN-SIZE FOR CHARACTERS.
...