Given a column name, returns the column index number.
Syntax
For C:
#include "usrdecs" short result, short col_idx; char col_name[36]; short source_or_target; result = GET_COLUMN_INDEX(&col_idx, col_name, source_or_target);
For TAL:
?source usrdect int result; int .ext col_idx; string .ext col_name; int source_or_target; result := GET_COLUMN_INDEX (col_idx, col_name, source_or_target);
For COBOL:
?CONSULT =EXTRACT (or =REPLICAT) 01 result PIC S9(4) COMP. 01 col-idx PIC S9(4) COMP. 01 col-name PIC X(36). 01 source-or-target PIC S9(4) COMP. ENTER C "GET_COLUMN_INDEX" using col-idx, col-name, source_or_target, giving result.
col_idx
col-idx
A sequential number from 0 to (number of columns - 1) that identifies a column.
col_name
col-name
The name of the column from the SQL catalog.
source_or_target
source-or-target
Represented by either EXIT‐FN‐SOURCE‐VAL
or EXIT-FN-TARGET-VAL
to indicate whether the record is a source or target record.
result
A code indicating whether the call was successful or not.