A host variable is a variable that is referenced in an SQL statement embedded in an application program. You use host variables to:
Host variables are not used in SQL statements submitted through the command facility.
Note: An INTO clause is required for SQL SELECT statements embedded in host programs.
An indicator variable is a host variable used to indicate whether the value in another host variable represents a null or truncated value. The use of indicator variables is optional. You can reference a host variable in an SQL statement with or without naming an associated indicator variable. However, if a SELECT or FETCH statement causes a null value to be assigned to a host variable without an associated indicator variable, CA IDMS returns an error.
When assigning a value to a host variable, CA IDMS sets the associated indicator variable as follows:
|
Indicator variable |
Meaning |
|---|---|
|
-1 |
The value assigned to the host variable was null. The contents of the host variable are unchanged. |
|
0 |
The host variable contains a non-null value that has not been truncated. |
|
1 or greater |
The host variable contains a truncated value. The value in the indicator variable is the length in bytes of the original untruncated value. |
Before you execute an SQL statement that references a host variable, you must declare the variable to CA IDMS:
A single application program can include both explicit and implicit host variable declarations.
Note: For more information about using the INCLUDE statement to declare host variables, see INCLUDE.
In an explicit host variable declaration, you specify the name and data type of the variable. Depending on the program language, additional information about the variable may also be required (for example, the COBOL level number).
Host variable names must conform to language-specific rules for forming variable names.
Note: For more information about language-specific instructions for declaring host variables in an SQL declaration section, see the CA IDMS SQL Programming Guide.
|
Copyright © 2014 CA.
All rights reserved.
|
|