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” on page 163.
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:
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:
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.