Host Variables

Host variables provide a way for embedded SQL to use variables that are declared in COBOL. They are declared in the SQL DECLARE section of Working-Storage. They are distinguished from database objects (such as columns or tables) by a leading colon (":"). Host variables can be used as input to a SELECT statement or they can be used as output to store the results of an SQL query. The pre-compiler recognizes COBOL variables only if they have been declared in an SQL BEGIN DECLARE section.

For example, in the select1.sqb program, the variables MIN-C-NUMBER and MAX-C-NUMBER are declared in Working-Storage. When embedded SQL statements refer to these variables, they appear as :MIN-C-NUMBER and :MAX-C-NUMBER. See Host Variables for more information on host variables.