I have two application packages that use different initial program entries, which creates a library list for that application, so now I have to setup and maintain different user IDs for each package. Is there a way to get around this problem and use only a single user ID for both applications?
Providing that you have access to the source of the initial programs and can change it, I?ll outline a technique that I?ve used to call one software package from another. Following is a program that gets the current library list, allows it to be changed and then changes it back to it?s original values before exiting the program. For example, say Software package A is your primary system where your users spend most of their time but they sometimes need to use Software package B. Add a menu option to Package A that will call package B. In the package B initial program, add the following lines of code. When they exit package B and return to package A, their library list is returned to the way package A needs it. This program only resets the library list. If both packages use the *LDA, you will want to add code to save and reset that as well.
PGM DCL VAR(&LIBL) TYPE(*CHAR) LEN(275)
DCL VAR(&CMD2) TYPE(*CHAR) LEN(512)
DCL VAR(&LEN) TYPE(*DEC) LEN(15 5) VALUE(256)
/* KEEP ORIGINAL LIBRARY LIST */
/* CHANGE LIBRARY LIST AND CALL OTHER SOFTWARE PACKAGE */
/* CHANGE LIBRARY LIST BACK TO ORIGINAL VALUES */
CHGVAR VAR(&CMD2) VALUE('CHGLIBL LIBL(' *CAT &LIBL +
CALL PGM(QCMDEXC) PARM(&CMD2 &LEN)