%SUBARR Problem with Indicators

Q: When I try the following operation:

eval %subarr(*in:50:5) = '00000';

I get the following compile error: “The expression is not valid for assignment to an indicator or indicator data structure.” I get the same error when I try it without the 3rd parameter as

eval %subarr(*in:50) = '00000';

A: I have not tried this on a a V5R3 machine, but…Try using a different array name pointing to *IN. Then use %Subarr with that array. Something along these lines:

 

D Ptr             S               *   Inz(%Addr(*In))
D Indicators      S              1    Dim(99)
D                                     Based(Ptr)

 /Free
  %Subarr(Indicators:50:5) = '10101';
 /End-free

The compiler error seems to indicate that you cannot use %Subarr with the *In array (although the documentation does not mention this restriction). So, if you can get the indicators into another array, it might work.