INARRAY

INARRAY returns a BIT(1) value that indicates whether an expression is equal to any of the elements of an array.

Read syntax diagramSkip visual syntax diagram
>>-INARRAY(x,y)------------------------------------------------><

x
Scalar expression. x must have a type that is comparable with the type of the elements of y.
y
Array expression.

When y is a reference to a one-dimensional STATIC NONASSIGNABLE array with a simple INITIAL list, the compiler assumes the elements of y are constant and processes INARRAY( x, y ) as if it were INLIST( x, ... ) where ... denotes the elements of y.

For example, given
dcl countryCode char(2);
dcl ccs(3) char(2) static nonasgn init( 'AT', 'DE', 'CH' );
then
INARRAY( countryCode, ccs )
is the same as
INLIST( countryCode, 'AT', 'DE', 'CH' )





Published: 23 December 2018