× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi, Rob:

There are a few problems with this approach:

RTVSYSVAL SYSVAL(QUSRLIBL) returns an "array" of 25 elements of 10 characters each, with NO intervening spaces, so if any of the library names are 10 characters long, they will run "up against" the next entry, and this will not be valid in a CHGLIBL command.

Hence, you will need to create two variables such as:

DCL VAR(&CMD) TYPE(*CHAR) LEN(300) VALUE('CHGLIBL LIBL(')
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300)

Then, loop through the array in &USRLIBL extracting the library names, as follows:

LOOP:
IF (%SST(&USRLIBL 1 10) *NE ' ') THEN(DO)
CHGVAR VAR(&CMD) VALUE(&USRLIBL |< ' ' || %SST(&USRLIBL 1 10)
CHGVAR VAR(&USRLIBL) VALUE(%SST(&USRLIBL 11 240))
GOTO LOOP
ENDDO
CHGVAR VAR(&CMD) VALUE(&CMD |< ') CURLIB(*SAME)')
CALL PGM(QSYS/QCMDEXC) PARM(&CMD &CMDLEN)

Hope that helps,

Mark S. Waterbury

> On 6/18/2013 12:15 PM, rob@xxxxxxxxx wrote:
I have this simple little test program:
PGM
DCL &JOBLIBL *CHAR 2750 /* User part of library list */
DCL &USRLIBL *CHAR 250 /* User part of library list */

DSPJOB OUTPUT(*PRINT)
RTVJOBA USRLIBL(&JOBLIBL)
RTVSYSVAL SYSVAL(QUSRLIBL) RTNVAR(&USRLIBL)
CHGLIBL LIBL(&USRLIBL) CURLIB(*SAME) /* 1209 */
DSPJOB OUTPUT(*PRINT)
CHGLIBL LIBL(&JOBLIBL) CURLIB(*SAME) /* 1211 */
DSPJOB OUTPUT(*PRINT)

END:
ENDPGM

CALL A
Value 'QTEMP ' for parameter LIBL not a valid name.
Error found on CHGLIBL command.
Function check. CPF0001 unmonitored by A at statement 1209, instruction
X'0023'.
CPF0001 received by A at 1209. (C D I R)
? I
Value 'QTEMP ' for parameter LIBL not a valid name.
Error found on CHGLIBL command.
Function check. CPF0001 unmonitored by A at statement 1211, instruction
X'002F'.
CPF0001 received by A at 1211. (C D I R)
? D

Results of dump:

Variable Type Length Value
*...+....1....+....2....+
&JOBLIBL *CHAR 2750 'QTEMP QGPL '
+26 ' '
+51 ' '
...
&USRLIBL *CHAR 250 'QTEMP QGPL '
+26 ' '
+51 ' '
...


Rob Berendt


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.