You can use bsfn B34A1030 Execute external program to send OS instructions like this. Just pass in the command you want to execute in the szCommandLine parm. I'd create a wrapper bsfn and map this via OCM's to your iSeries.
This may be best by calling a simple CL program to execute the command. You can alter your library list etc then just for that job. In this case youd pass in something along the lines of CALL LIB/PGM PARM('A' 'B' 'C') etc
Remember that if you are calling the AS400 program from an application you are running on the client PC. If you do not write the bsfn you will have to do a RMTCMD to call a CL on the 400.
Just to point out that this function runs whereever it is executed from. Meaning if you run it on your local machine for testing than it will run locally but if the UBE is deployed and submited on the server than the job will run on the server. Its all upto you how you want to use it.
Under some conditions the AS400 command is run by the JDENET_K "Call Object" kernal jobs. If you alter the library list of your job, you are actually changing the library list of the Kernal, and the library list change will stay in effect.
This may cause unexpected side effects, especially if multiple AS400 commands are executed by the same kernal.
There are work-arounds etc, but it's something to be aware of.
Your quier right, and care does need to be taken. I should have probably qualified this with a little info on what changing your library list would do but to keep it simple I'd look to have a single library which would contain all the objects that calls like this from OW would need. If there's multiple libraries being added then care must be taken to avoid duplicate named objects etc.