50 pts.
 CHGLIBL command in CLLE
Trying to use a single variable with libraries concated from a file. When the command runs in the program I get XXXXX is not a valid library name. If I create a command string with the variable and use QCMDEXEC it works perfectly. The formating of the variable is obviously correct or the qmd call would not work either. Debug just does not give anything to indicate why it is failing.

Software/Hardware used:
ASKED: September 25, 2006  8:58 AM
UPDATED: September 27, 2006  12:47 PM

Answer Wiki:
Try using the following: First fill the &libl with the wanted libraries separated by a space . This should work because I am using it all the time. DCL VAR(&LIBL) TYPE(*CHAR) LEN(2750) DCL VAR(&CMD) TYPE(*CHAR) LEN(3000) ... CHGVAR VAR(&CMD) VALUE('CHGLIBL LIBL(' *CAT &LIBL + *TCAT ')') CALL PGM(QCMDEXC) PARM(&CMD 3000)
Last Wiki Answer Submitted:  September 26, 2006  8:30 am  by  Jadima   0 pts.
All Answer Wiki Contributors:  Jadima   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The reason the command fails when you just take a variable library list and straight out execute a CHGLIBL is that the command is expecting a parameter list. For a list parameter, the values are passed with a binary count of the number of list elements following by the library names. Since you are in theory only passing one library with a really big name, it is only expecting one library with a 10 character name. The first 10 characters of your variable probably has one library and the partial name of the second library in the first 10 bytes of the variable.

The CHGVAR concatenating of the the variable into a CHGLIBL is the only way I have been able to do this.

 645 pts.