Expansion of Host-variable

The expanded parameters of host-variable identify declared program variables.
idmscu
The expanded parameters of host-variable identify declared program variables.
Syntax
Expansion of host-variable
►►─── :host-variable-name ─┬──────────────────────────────────────┬───────────►◄                            └─ indicator :indicator-variable-name ─┘
Parameters
  • :
    host-variable-name
    Identifies the name of a host variable previously declared to the program.
  • indicator :
    indicator-variable
    Identifies the name of a host variable previously declared to the program to serve as an indicator variable.
    Indicator-variable
    must reference a variable that was declared with a numeric data type.
Usage
A Colon Must Precede the Variable Name
When you reference a host variable in an SQL statement, you must precede the variable name with a colon (:).
No Comma Between Host and Indicator Variables
There is no required separator between a host variable and its associated indicator variable when they are referenced in an SQL statement. The only valid separator is the optional keyword
indicator
.
Non-bulk Structure in COBOL
In certain SQL statements embedded in a COBOL application program,
host-variable
may refer to a non-bulk structure defined in the host program.
Example
The following SELECT statement retrieves data into host variables. BIRTH-DATE-I is an indicator variable that is associated with BIRTH-DATE-HOST because the BIRTH_DATE column may contain null values.
EXEC SQL    SELECT DEPT_ID, DEPT_NAME, EMP_ID       INTO :DEPT-ID-HOST,            :DEPT-NAME-HOST,            :EMP-ID-HOST,            :BIRTH-DATE-HOST :BIRTH-DATE-I       FROM DEPARTMENT D, EMPLOYEE E       WHERE D.DEPT_ID = E.DEPT_ID END-EXEC