DBCHERR - Call-Level Interface Version 2

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

Product
Call-Level Interface Version 2
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2418
lifecycle
previous
Product Category
Teradata Tools and Utilities

DBCHERR

DBCHERR retrieves error text corresponding to the CLI error code.

Parameters

DBCHERR (ErrorCode, dbcptr, ErrPtr)

where:

 

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 Chapter 5: 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 Chapter 5: 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.

Examples

Method 1:

.
.
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:

.
.
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;
.
.