You can see the example provided in this topic to learn how to run CL commands in an i5/OS™ PASE program.
/* sampleCL.c example to demonstrate use of sampleCL to run a CL command Compile with a command similar to the following. xlc -o sampleCL -I /whatever/pase -bI:/whatever/pase/as400_libc.exp sampleCL.c Example program using QP2SHELL() follows. call qp2shell ('sampleCL' 'wrkactjob') */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <as400_types.h> /* PASE header */ #include <as400_protos.h> /* PASE header */ void main(int argc, char* argv[]) { int rc; if (argc!=2) { printf("usage: %s \"CL command\"\n", argv[0]); exit(1); } printf("running CL command: \"%s\"\n", argv[1]); /* process the CL command */ rc = systemCL(argv[1], /* use first parameter for CL command */ SYSTEMCL_MSG_STDOUT SYSTEMCL_MSG_STDERR ); /* collect messages */ printf("systemCL returned %d. \n", rc); if (rc != 0) { perror("systemCL"); exit(rc); } }