Problem solve Get help with specific problems with your technologies, process and projects.

Execute CL commands within an RPG program

This tip includes a QCMDEXC program to execute the CL commands from an RPG program.

To execute the CL commands from an RPG program, use the QCMDEXC program. This program requires two parameters. The first parameter is of type Character, and this will be the command you you wish to execute. The second parameter will be of length 15 with 5 decimal places.
*************** Beginning of data ************************* 
0145.02      E                    COM    74 222  1                 
0145.03      C                     Z-ADD9         LEN              
0145.04      C*                    MOVELCOMM      COM              
0145.05      C                     CALL 'QCMDEXC'                  
0145.06      C                     PARM           COM              
0145.07      C                     PARM           LEN    155       
0150.00      C                     SETON                     LR    
0151.00 **                                                         
0152.00 WRKACTJOB                                                  
        ****************** End of data **************************** 

Dig Deeper on RPG iSeries programming