Indicator variables in PL/I

An indicator variable is a 2-byte integer (or an integer declared as BIN FIXED(15)). An indicator variable array is an array of 2-byte integers. You declare indicator variables in the same way as host variables. You can mix the declarations of the two types of variables.

The following diagram shows the syntax for declaring an indicator variable in PL/I.

Read syntax diagramSkip visual syntax diagramDECLAREDCL( ,variable-name )BINARYBINFIXED(15);1
Notes:
  • 1 You can specify host variable attributes in any order that is acceptable to PL/I. For example, BIN FIXED(31), BIN(31) FIXED, and FIXED BIN(31) are all acceptable.

The following diagram shows the syntax for declaring an indicator array in PL/I.

Read syntax diagramSkip visual syntax diagramDECLAREDCLvariable-name(dimension)(,variable-name(dimension1))BINARYBINFIXED(15)Alignment and/or Scope and/or Storage;
Notes:
  • 1 dimension must be an integer constant in the range 1–32767.

Example

The following example shows a FETCH statement with the declarations of the host variables that are needed for the FETCH statement and their associated indicator variables.
EXEC SQL FETCH CLS_CURSOR INTO :CLS_CD,
                               :DAY :DAY_IND,
                               :BGN :BGN_IND,
                               :END :END_IND;
You can declare these variables as follows:
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);