On our as/400 we have a test environment and a productive environment. Once we tested our programs are working, we can put them in the productive environment. Both environments contain a similiar set of libraries.
The basic mechanism to tell our programs, in which environment they work, are liblists used for the jobs they run in. That works great, for some things, but for others it doesn't. Therefore we often have a parameter passed to the programs on job submission, that tells the program to work in either test or productive environment. That annoys the hell out of me, since my programs always have to carry this parameter throughout their whole execution time, and often even pass it on to other programs. Sometimes the initial program does not even need the information itself, but still has to take it as a parameter, because it calls a program that does need it.
To present the specific problem I am faced with:
Communication between individual parts of a bigger process is often done via dataqueues throughout our sytem. Reading a specific DTAQ according to the liblist works like a charm, simply call RCVDTAQ
on the DTAQ's name, the liblist takes care of choosing the right lib. Same goes for writing into DTAQs.
But sometimes the program has to create a new DTAQ before listening or writing to it. Now that does not work with our layout and the liblists. Think of it like this:
PROD-liblist:
PPGMLIB1
PPGMLIB2
PDFILELIB1
PDTAQLIB1
P...
...
TEST-liblist
TPGMLIB1
TPGMLIB2
TDFILELIB1
TDTAQLIB1
T...
...
Now my program should create the DTAQ in ?DTAQLIB1
, where ?
should be either P
or T
.
My first idea would be to go through the liblist and look for the entries PDTAQLIB
or TDTAQLIB
, and take whichever comes first -- but than I couldn't figure out how to to that (hence my connected question: How can I read the liblist from within an ILE-Program? (preferably RPG or CL)).
I know I could possibly achieve my goal by checking, which user owns the current job, but that would break our logic of selecting the libs by liblists (like our current workaround does).
Is there anything I'm missing? Some special way to to call CRTDTAQ
maybe, or some special api to do this liblist comparison, that I'm trying to write?