Indicator Data Items
An indicator data item is a 2‑byte integer numeric data item. You can use an indicator data item in an application in three ways:
• In a statement that retrieves data from Ingres, you can use an indicator data item to determine if its associated host variable was assigned a null value.
• In a statement that sets data to Ingres, you can use an indicator data item to assign a null to the database column, form field, or table field column.
• In a statement that retrieves character data from Ingres, you can use an indicator data item to check if the associated host variable is large enough to hold the full length of the returned character string. You can also use SQLSTATE or SQLCODE to do this. It is preferable to use SQLSTATE because SQLCODE is a deprecated feature.
An indicator data item declaration must have the following syntax:
level-number indicator-name PIC [IS] S9(p) [USAGE [IS]] COMP
where p is less than or equal to 4.
Example: Indicator declaration
01 IND-VAR PIC9(2) USAGE COMP.
01 IND-TABLE.
02 IND-ARRAY PIC S9(2) USAGE COMP OCCURS 10 TIMES.
When associating an indicator array (COBOL table) with a COBOL record, you must declare the indicator array as an array of 2‑byte integers. In the example above, the data item IND‑ARRAY can be used as an indicator array with a record assignment.