IBM Support

Handling a Variable That Contains a PARMS List in a CL Program

Troubleshooting


Problem

This document includes information on handling a variable that contains a PARMS list in a CL program.

Resolving The Problem

Many CL commands can use a PARM list for one of its options. If you attempt to bring this list into a CL variable with a CHGVAR or a retrieve command, it loses its quotes. These quotes are needed or you will receive message CPD0078 when you try to run the command.
 
Disclaimer: This is an example only. IBM accepts no responsibility for its correctness.


Example of Failing CL Program CHGLIBL1
             PGM
             DCL        VAR(&SYSLIBL) TYPE(*CHAR) LEN(165)
             DCL        VAR(&USRLIBL) TYPE(*CHAR) LEN(275)
             RTVJOBA    SYSLIBL(&SYSLIBL) USRLIBL(&USRLIBL)
             MONMSG     MSGID(CPF2103) EXEC(GOTO CMDLBL(ENDPGM))
             CHGLIBL    LIBL(&USRLIBL)
 ENDPGM:     ENDPGM   
> call chglibl1                                           
  Value 'QGPL      ' for parameter LIBL not a valid name. 
  Error found on CHGLIBL command.                         
Message ID . . . . . . :   CPD0078       Severity . . . . . . . :   30   
Message . . . . :   Value 'QGPL      ' for parameter LIBL not a valid name.  


This is how a PARM list has to be handled when using a variable.

Example of Working CL Program source CHGLIBL2
 
             PGM
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)
             DCL        VAR(&LIBLIST) TYPE(*CHAR) LEN(275)
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(285)
             RTVJOBA    USER(&USER) USRLIBL(&LIBLIST)
             CHGVAR     VAR(&CMD) VALUE('CHGLIBL (' *CAT &LIBLIST +
                          *TCAT ' QIWS' *TCAT ')')
             CALL       PGM(QCMDEXC) PARM((&CMD) (285))
             ENDPGM       
Before calling the CL program the LIBL is:
                                                                              
                                                                              
                           ASP                                                
Opt  Library     Type      Device      Text                                   
     QSYS        SYS                   System Library                         
     QSYS2       SYS                   System Library for CPI's               
     QHLPSYS     SYS                                                          
     QUSRSYS     SYS                   System Library for Users               
     SST         SYS                   DO NOT REMOVE FROM QSYSLIBL - SST TOOLS
     QMGTOOLS    SYS                                                          
     BIMBRA      CUR                                                          
     QGPL        USR                   General Purpose Library                
     QTEMP       USR                                                          
     QDEVELOP    USR                                                          
     WFLABXX     USR                                                          
The CL adds library QIWS to libl.
> call chglibl2        
  Library list changed.

Use DSPLIBL to examine the LIBL:
                                                                              
                           ASP                                                
Opt  Library     Type      Device      Text                                   
     QSYS        SYS                   System Library                         
     QSYS2       SYS                   System Library for CPI's               
     QHLPSYS     SYS                                                          
     QUSRSYS     SYS                   System Library for Users               
     SST         SYS                   DO NOT REMOVE FROM QSYSLIBL - SST TOOLS
     QMGTOOLS    SYS                                                          
     BIMBRA      CUR                                                          
     QGPL        USR                   General Purpose Library                
     QTEMP       USR                                                          
     QDEVELOP    USR                                                          
     WFLABXX     USR                                                          
     QIWS        USR                                                          
                             
 

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p0000006x8GAAQ","label":"CL"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"and future releases;7.1.0"}]

Historical Number

13590828

Document Information

Modified date:
13 May 2025

UID

nas8N1018266