I have got an interesting topic on DB SQL WHERE clause. The below way of SQL improves DB2 performance. The below query tells how to use ARRAY of variables in ‘IN’ list.
WHERE ABS_TD IN (:WS-LIST)
Let’s assume WS-LIST has (A,B,C,D), then cursor will fetch all matching results into result table. The fetch executes one by one row.
Here, we need to make sure, the data type of subordinate item (WS-LIST), should be DCLGEN data type.
05 WS-LIST Redefined WS-LIST-INP1
10 LIST-ONE PIC s9(4) COMP.