15.10 - Dynamic SQL - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

prodname
Preprocessor2 for Embedded SQL
vrm_release
15.10
category
Programming Reference
featnum
B035-2446-035K

Dynamic SQL is supported in PL/I, and the application must code the necessary SQL Descriptor Area (SQLDA) structures. For details on the SQLDA and its fields, see SQL Stored Procedures and Embedded SQL (B035‑1148).

Define the necessary SQLDA structure in one of two ways:

  • Embed an EXEC SQL INCLUDE SQLDA statement into the application, which causes PP2 to generate the structure.
  • Code the SQLDA directly into the program. Use any name for the structure.
  • The generated SQLDA structure for a PL/I program is:

    DCL 1 SQLDA BASED(SQLDAPTR),
          2  SQLDAID  CHAR(8) INIT(’SQLDA   ’),
          2  SQLDABC   FIXED BIN(31),
          2  SQLN     FIXED BIN(15),
          2  SQLD     FIXED BIN(15),
          2  SQLVAR(SQLSIZE REFER(SQLN)),
             3 SQLTYPE   FIXED BIN(15),
             3 SQLLEN    FIXED BIN(15),
             3 SQLDATA   PTR,
             3 SQLIND    PTR,
             3 SQLNAME   CHAR(30) VAR;
    DCL SQLSIZE FIXED BIN(15);
    DCL SQLDAPTR PTR;