3.17 GET_COLUMN_INDEX_FROM_NAME

Valid For

Extract and Replicat

Description

Use the GET_COLUMN_INDEX_FROM_NAME function to determine the column index associated with a specified column name. 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.

If the database is case-sensitive, object names must be specified in the same letter case as they are defined in the hosting database; otherwise, the case does not matter.

Syntax

#include "usrdecs.h"
short result_code;
env_value_def env_value;
ERCALLBACK (GET_COLUMN_INDEX_FROM_NAME, &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 the column name

actual_length

The length of the column name within the buffer.

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

index

The returned column index for the specified column name.

Return Values

EXIT_FN_RET_INVALID_COLUMN
EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_INVALID_PARAM
EXIT_FN_RET_OK