I believe you are right about the inability to specify a library on the embedded SQL statement. A couple of ideas occur to me (I haven’t checked these so caveat emptor):
You could take a look at the ALIAS command for SQL – this might allow the softcoding of the library via a different route. It could be a temporary thing that got removed when you are done.
Alternatively you could break the process down. e.g.
A CL that goes through three steps:
1) Get the user input via a HLL program.
2) Do any overrides for libraries / members whatever SQL can’t handle.
3) Use another HLL program to run the SQL and present the results.
Hope there’s something of use in this lot.