The operator in is a binary operator used in an elementary logical expression that has the following format:
An item used as a subscript of an array can not itself be an array element. In each of the following examples, myItemB[1] is both a subscript and an array element; as a result, the following syntax is not valid:
/* the next syntax is not valid */ myItemA[myItemB[1]] // this next syntax is not valid; but only // because myItemB is myItemB[1], the // first element of a one-dimensional array myItemA[myItemB]
The logical expression resolves to true if the generated program finds the search value. The search begins at the element identified by the last array subscript. If array is a one-dimensional array, the last subscript is optional and defaults to 1. If array is a multidimensional array, the following statements are true:
In relation to both one-dimensional and multidimensional arrays, the search ends at the last element of the one-dimensional array under review.
The logical expression that includes in resolves to false in either of these cases:
If the elementary logical expression resolves to true, the operation in sets the system variable sysVar.arrayIndex to the subscript value of the element that contains the search value. If the expression resolves to false, the operation sets sysVar.arrayIndex to zero.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.