3.25 GET_ERROR_INFO

Valid For

Extract and Replicat

Description

Use the GET_ERROR_INFO function to retrieve error information associated with a discard record. The user exit can use this information in custom error handling logic. For example, the user exit could send an e-mail message with detailed error information.

If the character session of the user exit is set with SET_SESSION_CHARSET to a value other than the default character set of the operating system, as defined in ULIB_CS_DEFAULT in the ucharset.h file, the message data that is exchanged between the user exit and the process is interpreted in the session character set.

Syntax

#include "usrdecs.h"
short result_code;
error_info_def error_info;
ERCALLBACK (GET_ERROR_INFO, &error_info, &result_code);

Buffer

typedef struct
{
long error_num;
char *error_msg;
long max_length;
long actual_length;
short msg_truncated;
} error_info_def;

Input

error_msg

A pointer to a buffer to accept the returned error message.

max_length

The maximum length of your allocated error_msg buffer to accept any resulting error message. This is returned as a NULL terminated string.

Output

error_num

The SQL or system error number associated with the discarded record.

error_msg

A pointer to the null-terminated error message string associated with the discarded record.

actual_length

The length of the error message, not including the null terminator.

msg_truncated

A flag (0 or 1) indicating whether or not the error message was truncated. Truncation occurs if the length of the error message plus a null terminator exceeds the maximum buffer length.

Return Values

EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_OK