Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Using indicator variables

An indicator variable is a two-byte integer (BIN FIXED(15)). 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. If an indicator variable array is used, all of the indicator variables in the array must be specified sequentially beginning with the first member. Any out of sequence indicator variable will be flagged as an error.

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;

The following diagram shows the syntax for a valid indicator variable.

Read syntax diagramSkip visual syntax diagram>>-+-DECLARE-+--variable-name--+-BINARY-+--FIXED(15)--;--------><
   '-DCL-----'                 '-BIN----'
 

The following diagram shows the syntax for a valid indicator array.

Read syntax diagramSkip visual syntax diagram>>-+-DECLARE-+--+-variable-name--(--dimension--)-----------+---->
   '-DCL-----'  |    .-,------------------------------.    |
                |    V                                |    |
                '-(----variable-name--(--dimension--)-+--)-'
 
>--+-BINARY-+--FIXED(15)--;------------------------------------><
   '-BIN----'
 

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)