Indicator Variables and Structures |Teradata Preprocessor2 for Embedded SQL. - Indicator Variables and Structures - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide - 17.20

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Teradata Preprocessor2
Release Number
17.20
Published
April 2023
ft:locale
en-US
ft:lastEdition
2023-04-21
dita:mapPath
neh1679404006646.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2446
Product Category
Teradata Tools and Utilities

To facilitate use of indicator variables with host structures for output, PP2 accepts the definition of an array of small integers. For example:

struct
      {
      char     FIELD1[21];
      long     FIELD2;
      char     FIELD3[7];
      float    FIELD4;
      } STRUCTURE1;
short  INDVAR[4];
   EXEC SQL
      SELECT *
      INTO   :STRUCTURE1 :INDVAR
      FROM   table1
      WHERE  col1 = :hostvar2;
   EXEC SQL
      FETCH  cursor1
      INTO :STRUCTURE1 :INDVAR;

In both examples, INDVAR[0] is associated with FIELD1, INDVAR[1] with FIELD2 and so forth. The host variable is not required to have an associated indicator variable. The mentioned INDVAR array could have less than four elements. However, PP2 associates host variables and indicator variables one to one in order of occurrence.

If there were two elements defined for the indicator variables in these examples, FIELD1 and FIELD2 would have associated indicators; FIELD3 and FIELD4 would not.

Indicator arrays can be associated only with a structure. Use of an array with individual elements results in a PP2 error.