But before going to production,
OK... if that is just a curiosity, the attempt should stop there
I consider a serious processing flaw to build programs in sneaky ways.
Each program should be correctly classified and built using the appropriate procedures
even more if You are using some source control application. where the correct classification of a program is vital for the automated build
db2 precompile, cics precompile, compile, link
proper program classification will ensure that at LINK time the proper libraries are used