Use 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. On retrieval, an indicator variable is used to show whether its associated host variable has been assigned a null value. On assignment to a column, a negative indicator variable is used to indicate that a null value should be assigned.

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;
Related reference
References to variables