Declaring host variables and indicator variables in COBOL

You can use host variables and host structures in SQL statements in your program to pass data between IMS and your application.

Procedure

To declare host variables and host structures:

  1. Declare the variables according to the following rules and guidelines:
    • You must explicitly declare all host variables that are used in SQL statements in the WORKING-STORAGE SECTION or LINKAGE SECTION of your program's DATA DIVISION.
    • You must explicitly declare each host variable before using them in an SQL statement.
    • You cannot implicitly declare any host variables through default typing or by using the IMPLICIT statement.
    • Ensure that any SQL statement that uses a host variable is within the scope of the statement that declares that variable.
  2. Optional: Define any associated indicator variables, arrays, and structures.