COBOL and 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

Any valid COBOL host variable can be used in a SQL statement. However, this does not mean that all variables can be used. Host variables must meet certain requirements before PP2 accepts them as usable in SQL statements. See Host Variable Declaration.

Define host variables outside a structure at level 01 or 77. Host variables within a structure can be level 02 through 48. Level 49 is reserved for varying character fields. Level 66 and 88 items are ignored.

Any valid COBOL variable name can be used as a host variable name, including names with embedded hyphens.

Precede all host variable names with a colon, when the host variable:
  • Begins with a number
  • Is used for input in situations where the database expects a numeric constant

The USAGE IS DISPLAY clause is accepted only for a host variable of character type (PIC X(n)).

The following clauses invalidate a host variable definition for use in an embedded SQL statement:
  • BLANK
  • WHEN ZERO
  • JUSTIFIED
  • SIGN

Host variables which are not SQL strings are used only to represent data values. Do not use them to represent database, table, view, macro or column names.

Declare host variables in the WORKING STORAGE SECTION or the LINKAGE SECTION of the COBOL program.

Variables declared elsewhere are not valid.