References to host variables
Host variables are defined directly by statements of the host language. A host-variable in an SQL statement must identify a host variable that is described in the program according to the rules for declaring host variables. Host variables cannot be referenced in dynamic SQL statements; parameter markers must be used instead.
A host variable is a data element in COBOL.
A host-variable in an SQL statement must identify a host variable that is described in the program according to the rules for declaring host variables.
The term host-variable, as used in the syntax diagrams, shows a reference to a host variable. In the INTO clause of a FETCH statement, a host variable is an output variable to which a value is assigned by IMS. A host variable can also be an input variable which provides a value to IMS.
- variable references
The general form of a host variable reference is:
Each host identifier must be declared in the source program.
An SQL statement that refers to host variables must be within the scope of the declaration of those host variables. For host variables referred to in the SELECT statement of a cursor, the OPEN statement, and the DECLARE CURSOR statement have to be in the same scope.
All references to host variables must be preceded by a colon. If an SQL statement references a host variable without a preceding colon, the coprocessor issues an error for the missing colon or interprets the host variable as an unqualified column name, which might lead to unintended results. The interpretation of a host variable without a colon as a column name occurs when the host variable is referenced in a context in which a column name can also be referenced.