Indicator variables, arrays, and structures
An indicator variable is associated with a particular host variable. Each indicator variable contains a small integer value that indicates some information about the associated host variable. Indicator structures serve the same purpose for host variable structures.
You can use indicator variables to perform the following actions:
- Determine whether the value of an associated output host variable is null
- Determine the original length of a character string that was truncated when it was assigned to a host variable
You can use indicator structures to perform these same actions for individual items in host data structures.
If you provide an indicator variable for a nullable field of a variable-length segment, a negative value (-1) is set for the indicator variable when the field is null. Your program should check the indicator variable before using the field to determine whether the field is truly null. If the indicator variable contains a positive integer, the retrieved character string value is truncated, and the integer is the original length of the string.
An indicator structure is an array of halfword integer variables that supports a specified host structure. If the field values that your program retrieves into a host structure can be null, you can attach an indicator structure name to the host structure name. This name enables IMS to notify your program about each null value it returns to a host variable in the host structure.