Previous Topic: The ADDRESS SQL Environment and Host VariablesNext Topic: Specifying Stem Names


Description of Host Variables

When you fetch information from a relational table through a SELECT statement, CA OPS/MVS always returns values in the form of host variables unless you invoked the statement from a TSO terminal.

Note: If you invoke a SELECT statement manually, your TSO terminal displays the returned values.

What a host variable is depends on how you invoke an SQL statement. For instance, if you invoke a statement from a rule or an OPS/REXX program, then the host variables are OPS/REXX variables. Static variables can be used as host variables, but global and compound variables cannot.

However, you can use this technique:

ADDRESS SQL
  "SELECT XYZ FROM TABLEX WHERE COLDATA='"stem.abc"'"

In this example, REXX evaluates the compound symbol (stem.abc) because it is outside of the host command string, and substitutes its value in the SQL host command so that SQL sees a constant value rather than a host variable. This process is slightly more efficient than having SQL do the host variable resolution. When you use this technique, you may use global variables as well as compound symbols.

If you invoke a Statement from:

A host variable can contain as many as 32,000 characters of data. If you provide no specific host variable names, CA OPS/MVS uses the names of the columns in the relational table as variable names. In an SQL statement, you indicate a host variable (where the host is a REXX program) by prefixing the variable name with a colon (:).