1. Create a source file called QQMQRYSRC, record length 91 (really!).
2. Add a member to QQMQRYSRC, say UPPER.
3. Put the following statement in the source member:
update &file set &field = upper(&field) where &field <> upper(&field)
This uses replacement variables &file and &field. These are what takes away the hard-coding. Later you'll execute STRQMQRY and specify values for these variables. Anything you put there simply replaces the variable. Therefore, you can even put in a qualified filename.
4. Create the *QMQRY:
CRTQMQRY QMQRY(somelib/UPPER) SRCFILE(somelib/QQMQRYSRC) SRCMBR(UPPER)
5. Assuming an appropriate library list, run the statement with
STRQMQRY QMQRY(UPPER) SETVAR((FILE filename) (FIELD fieldname))
6. You can use this in a CL, which could even be the command processing program for something like
CVT2UPR FILE(filename) FIELD(fieldname)
In this case, the STRQMQRY command could be
STRQMQRY QMQRY(UPPER) SETVAR((FILE &FILE) (FIELD &FIELD))