Using indicator variables in PL/I applications that use SQL

An indicator variable is a two-byte integer (BIN FIXED(p), where p is 1 to 15).

You can also specify an indicator structure (defined as an array of halfword integer variables) to support a host structure.

Indicator variables are declared in the same way as host variables and the declarations of the two can be mixed in any way that seems appropriate to the programmer.

Example

Given the statement:

EXEC SQL FETCH CLS_CURSOR INTO :CLS_CD,
                               :DAY :DAY_IND,
                               :BGN :BGN_IND,
                               :END :END_IND;

Variables can be declared as follows:

  EXEC SQL BEGIN DECLARE SECTION;
  DCL CLS_CD    CHAR(7);
  DCL DAY       BIN FIXED(15);
  DCL BGN       CHAR(8);
  DCL END       CHAR(8);
  DCL (DAY_IND, BGN_IND, END_IND)   BIN FIXED(15);
  EXEC SQL END DECLARE SECTION;