Using COBOL Structures as Input Host Variables - 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
The following rules apply to using host variables in a COBOL program:
  • Do not use the keyword FILLER in a structure other than a varying character field, otherwise the structure as a whole is invalidated. Instead, reference valid individual fields.
  • Use host structures to insert data into managed databases.

    This feature is useful for an INSERT with a VALUES clause that inserts multiple fields into a table using host variables.

  • A host structure as an entity is valid for input only if all fields of the structure are validly defined.

    All of the fields of the structure are passed to the database, therefore the application must ensure that the structure elements match the number of elements specified in the SQL statement.

  • Do not use a structure reference as an input entity in a WHERE clause or any place where a single field is expected.
  • Using individual fields of a structure for input is valid if the fields are defined following PP2 rules.
  • PP2 supports structured host variables to a depth of two, following the same rules as SQL/DS and DB2.
  • Qualified references in embedded SQL statements are expressed using PL/I syntax; that is, with a dot separating the levels of qualification.
  • A typical host structure definition takes the following form:
    01 STRUCTURE1.
       02 FIELD1   PIC X(20).
       02 FIELD2   PIC S9(9) <comp>.
       02 FIELD3   PIC X(6).
       02 FIELD4   PIC S9(11)V99 COMP-3.

where <comp> is COMP-5 for MF COBOL and COMP for all other COBOL compilers.

This is one of several ways to declare a structure. Other valid forms are described in Host Variable Declaration.

The structure level can go deeper than the two levels shown, but the items, if individually referenced, must be uniquely identifiable with a qualification depth of no more than two.