Too bad RPG IV still doesn't support a case-insensitive scan operator. This is so painful to RPG developers that I sadly see them building applications that force end-users to type in data in ALL UPPER CASE to simply avoid the short-coming in the %SCAN built-in function.
What some developers forget, is that you can embed existing RPG IV built-in functions as a parameter of another RPG IV built-in function. For example, you can embed %XLATE as a parameter of the %SCAN built-in function, as follows:
D UP C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' D low C 'abcdefghijklmnopqrstuvwxyz' D desc S 4096A Varying Inz('john q public') D nPos S 10I 0 /free nPos = %scan('Q' : %xlate(low:up:DESC)); /end-free
In this example, I've set up two named constants, UP and LOW. The used those as the translation table for %XLATE. I further embedded that %XLATE into a %SCAN built-in function while scanning the DESC field for the letter "Q". In this case, since the "Q" is in upper case, I %xlate the data I am scanning to uppercase. This allows me to let the end-users type in data as mixed case, and not worry about how the search is going to work.
In addition, both SQL and legacy DDS Logical Files have the ability to dynamically translate their search data to uppercase.