Indicator Format

The indicator format is a special type of character data. Indicators are all one byte long and can only contain the character values '0' (off) and '1' (on). They are generally used to indicate the result of an operation or to condition (control) the processing of an operation. The default value of indicators is '0'.

You define an indicator field by specifying the IND keyword in a free-form definition or by specifying N in the Data-Type entry of a fixed-form specification. You can also define an indicator field using the LIKE keyword on the definition specification where the parameter is an indicator field. Indicator fields are also defined implicitly with the COMMIT keyword on the file description specification.

A special set of predefined RPG IV indicators (*INxx) is also available. For a description of these indicators, see RPG IV Indicators.

The rules for defining indicator variables are:
  • Indicators can be defined as standalone fields, subfields, prototyped parameters, and procedure return values.
  • If an indicator variable is defined as a prerun-time or compile-time array or table, the initialization data must consist of only '0's and '1's.
    Note: If an indicator contains a value other than '0' or '1' at runtime, the results are unpredictable.
  • If the keyword INZ is specified, the value must be one of '0', *OFF, '1', or *ON.
  • The keyword VARYING cannot be specified for an indicator field.
The rules for using indicator variables are:
  • The default initialization value for indicator fields is '0'.
  • Operation code CLEAR sets an indicator variable to '0'.
  • Blank-after function applied to an indicator variable sets it to '0'.
  • If an array of indicators is specified as the result of a MOVEA(P) operation, the padding character is '0'.
  • Indicators are implicitly defined with ALTSEQ(*NONE). This means that the alternate collating sequence is not used for comparisons involving indicators.
  • Indicators may be used as key-fields where the external key is a character of length 1.

CCSID of data in indicator format

Indicators are considered to have CCSID(*JOBRUN).