DBCHERR - Call-Level Interface Version 2

Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Call-Level Interface Version 2
Release Number
20.00
Published
January 2024
Language
English (United States)
Last Update
2024-05-14
dita:mapPath
bmn1691484839905.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
fvz1470444150352
Product Category
Teradata Tools and Utilities

DBCHERR retrieves error text corresponding to the CLI error code.

Parameters

DBCHERR (ErrorCode, dbcptr, ErrPtr)

where the following is true:

The parameter... Is the...
ErrorCode Four-byte integer error code
dbcptr Pointer to the area allocated by the application for use as DBCAREA.

The application program and CLI share the DBCAREA and use it for input of values to CLI and output of values from CLI.

ErrPtr Pointer to a structure to receive error codes. This structure is defined in COPTYPES.H, and has the following format:
typedef struct err_code {
   int e_class;
   int e_reason;
   long e_syst;
} *errpt_t;

This argument is optional and should be NULL if no specific error code information is desired.

Usage Notes

  1. There are two methods of retrieving error text:

    Method 1: msg_text in DBCAREA

    When dbcptr->dbciMsgP is NULL, retrieved error text is stored in the msg_text buffer in DBCAREA up to 76 bytes and its length is stored in the dbcptr->msg_len. For more information, refer to Message Text and Message Length in DBCAREA.

    Method 2: dbciMsgP in DBCAREA

    If dbcptr->dbciMsgP is NOT NULL and dbcptr->dbciMsgM > 0, retrieved error text is stored in the memory area pointed by dbciptr->dbciMsgP and its length is stored in dbcptr->dbcoMsgL. Applications are responsible for allocation and deallocation of the memory. For more information, refer to Message Area Pointer and Message Length Returned in DBCAREA.

  2. DBCHINI() and DBCHCL() functions return both error code and error text. Therefore, applications do not need to call DBCHERR() to retrieve error text after calling those functions.

Method 1 Example

.
.
struct DBCAREA dbc;
Int32 result = DBCHWL(...);
dbc.dbciMsgP = NULL;
if (DBCHERR(result, &dbc, NULL) != 0)
{
   printf("Error Text is %.*s\n", dbc.msg_len, dbc.msg_text);
}
.
.

Method 2 Example

.
.
struct DBCAREA dbc;
Int32 result = DBCHWL(...);
dbc.dbciMsgP = (char *)malloc(200);
dbc.dbciMsgM = 200;
if (DBCHERR(result, &dbc, NULL) != 0)
{
   printf("Error Text is %.*s\n", dbc.dbcoMsgL, dbc.dbciMsgP);
}
free(dbc.dbciMsgP);
dbc.dbciMsgP = NULL;
dbc.dbciMsgM = 0;
.
.