PP2 Processes - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide

Product
Teradata Preprocessor2
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-06-19
dita:mapPath
whb1544831946911.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities

PP2 includes a precompiler as well as the services that execute or provide runtime support for a compiled application. A precompiler is necessary to interpret the embedded SQL statements in the host program. Regardless of the host language, PP2 operation consists of two stages:

  1. The precompile phase, which precedes application compilation and linking.
  2. Execution, or runtime support, of the application.

During precompilation, PP2 reads and replaces all the SQL statements embedded in the host program with CLIv2 calls that are acceptable to the native compiler for the host language. The host programming language syntax remains unchanged.

At runtime, the inserted syntax runs in conjunction with Call-Level Interface version 2 (CLIv2) and Teradata Director Program (TDP) modules to provide a convenient interface between the application program and the database.

In a mainframe environment, start a TDP module before PP2 performs the precompile step. Do this even if no data access is required (that is, using NOSYNTAX).

The steps that PP2 performs, from logging on to the database through precompilation, are shown below. The example uses a COBOL program, though the process is similar for other languages:

  1. Logs a session onto the database and determines whether it is to be a Teradata mode or ANSI-compatible mode session.
  2. Checks the syntax of SQL statements in the host language source program, validating database objects against the entries in the Data Dictionary.
  3. Builds code in the DATA division for the data elements.
  4. Builds code in the PROCEDURE division to handle SQL statement passing to the database.
  5. Comments out the SQL source code.
  6. Produces COBOL source for input to the COBOL compiler.

The following figure gives a high-level view of starting with a PL/I embedded SQL program as the source input file, then precompiling, compiling, linking, and finally, running the PL/I program.

PP2 Operation