Previous Topic: SQLDA (EXECUTE, FETCH, or OPEN Statement)Next Topic: Glossary


SQLVAR and VS/COBOL

Before you can use the SQLDA in an EXECUTE, FETCH, or OPEN statement, the SQLDATA field must be loaded with the address of the host variable that is to receive data (for that column). The SQLIND field must also be loaded (if applicable) with the address of the 2-byte binary host null indicator variable.

When the value returned from a FETCH or SELECT INTO is null, a -1 is set at the address of the SQLIND variable. If the SQLIND variable is zero, then SQLCODE -1 is set to indicate that the null indicator host variable could not be set to indicate the null value. If SQLIND is used with a NOT NULL column, SQLIND is not updated.

In VS/COBOL II a "pointer" data type field can be associated with each host variable. The value in these pointer fields can be moved to the SQLDATA field to load the address of the host variable. In VS/COBOL, an Assembler subroutine must be used to determine the address of the host variable. For more information, see the example Assembler subroutine in the sample dynamic SQL program on the installation tape.

Field

Field

Value Expected or Returned

SQLVAR

SQLDATA

Contains the address of the host variable.

SQLVAR

SQLIND

If there is an associated indicator variable, SQLIND contains its address. If there is not an associated indicator variable, SQLIND is not used.

SQLVAR

SQLNAME

Not used