3.18 GET_COLUMN_NAME_FROM_INDEX

Valid For

Extract and Replicat

Description

Use the GET_COLUMN_NAME_FROM_INDEX function to determine the column name associated with a specified column index. 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 character data that is exchanged between the user exit and the process is interpreted in the session character set.

Database object names are returned exactly as they are defined in the hosting database, including the letter case.

Syntax

#include "usrdecs.h"
short result_code;
env_value_def env_value;
ERCALLBACK (GET_COLUMN_NAME_FROM_INDEX, &env_value, &result_code);

Buffer

typedef struct
{
char *buffer;
long max_length;
long actual_length;
short value_truncated;
short index;
short source_or_target;
} env_value_def;

Input

buffer

A pointer to a buffer to accept the returned column name. The column name is null-terminated.

max_length

The maximum length of your allocated buffer to accept the resulting column name. This is returned as a NULL terminated string.

index

The column index of the column name to be returned.

source_or_target

One of the following to indicate whether to use the source or target table to look up column information.

EXIT_FN_SOURCE_VAL
EXIT_FN_TARGET_VAL

Output

buffer

The null-terminated column name.

actual length

The string length of the returned column name. The actual length does not include the null terminator.

value_truncated

A flag (0 or 1) to indicate whether or not the value was truncated. Truncation occurs if the length of the column name plus the null terminator exceeds the maximum buffer length.

Return Values

EXIT_FN_RET_INVALID_COLUMN
EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_INVALID_PARAM
EXIT_FN_RET_OK